don't create homework folder before it's necessary (#2264)

This commit is contained in:
end-4
2025-10-24 17:37:34 +02:00
parent 435ff32904
commit a3ced86214
2 changed files with 4 additions and 12 deletions
@@ -23,15 +23,6 @@ Item {
property var suggestionQuery: ""
property var suggestionList: []
Connections {
target: Config
function onReadyChanged() {
if (Config.options.policies.weeb !== 0) {
Quickshell.execDetached(["bash", "-c", `mkdir -p '${root.downloadPath}' && mkdir -p '${root.nsfwPath}'`])
}
}
}
Connections {
target: Booru
function onTagSuggestion(query, suggestions) {
@@ -28,7 +28,7 @@ Button {
Process {
id: downloadProcess
running: false
command: ["bash", "-c", `[ -f ${root.filePath} ] || curl -sSL '${root.imageData.preview_url ?? root.imageData.sample_url}' -o '${root.filePath}'`]
command: ["bash", "-c", `mkdir -p '${root.previewDownloadPath}' && [ -f ${root.filePath} ] || curl -sSL '${root.imageData.preview_url ?? root.imageData.sample_url}' -o '${root.filePath}'`]
onExited: (exitCode, exitStatus) => {
imageObject.source = `${previewDownloadPath}/${root.fileName}`
}
@@ -170,9 +170,10 @@ Button {
Layout.fillWidth: true
buttonText: Translation.tr("Download")
onClicked: {
root.showActions = false
root.showActions = false;
const targetPath = root.imageData.is_nsfw ? root.nsfwPath : root.downloadPath;
Quickshell.execDetached(["bash", "-c",
`curl '${root.imageData.file_url}' -o '${root.imageData.is_nsfw ? root.nsfwPath : root.downloadPath}/${root.fileName}' && notify-send '${Translation.tr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'`
`mkdir -p '${targetPath}' && curl '${root.imageData.file_url}' -o '${targetPath}/${root.fileName}' && notify-send '${Translation.tr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'`
])
}
}