1
0
Fork 0

- [kami] prevented crash when downloading fails, notify an error instead.

This commit is contained in:
cage 2022-02-17 19:17:52 +01:00
parent 283930efef
commit 444f7939ce
1 changed files with 18 additions and 14 deletions

View File

@ -2525,7 +2525,10 @@ printed, on the main window."
(notify t)) (notify t))
"Download a file" "Download a file"
(when-let* ((win *filesystem-explorer-window*)) (when-let* ((win *filesystem-explorer-window*))
(flet ((on-input-complete (destination-file) (labels ((%download (win path destination-file)
(with-notify-errors
(fstree:download-path win path destination-file)))
(on-input-complete (destination-file)
(when (string-not-empty-p destination-file) (when (string-not-empty-p destination-file)
(with-enqueued-process () (with-enqueued-process ()
(when (not (fs:file-exists-p destination-file)) (when (not (fs:file-exists-p destination-file))
@ -2534,9 +2537,9 @@ printed, on the main window."
(with-blocking-notify-procedure (with-blocking-notify-procedure
((format nil (_ "Starting download of ~a") path) ((format nil (_ "Starting download of ~a") path)
(format nil (_ "Download completed in ~a") destination-file)) (format nil (_ "Download completed in ~a") destination-file))
(fstree:download-path win path destination-file) (%download win path destination-file)
(info-message destination-file)) (info-message destination-file))
(fstree:download-path win path destination-file)))))) (%download win path destination-file))))))
(if force (if force
(on-input-complete output-file) (on-input-complete output-file)
(ask-string-input #'on-input-complete (ask-string-input #'on-input-complete
@ -2856,6 +2859,7 @@ Note: existing file will be overwritten."
(local-dir (fs:maybe-append-directory-separator (os-utils:pwd)))) (local-dir (fs:maybe-append-directory-separator (os-utils:pwd))))
(labels ((on-input-complete (root-directory) (labels ((on-input-complete (root-directory)
(with-enqueued-process () (with-enqueued-process ()
(info-message (_"Preparing for download…"))
(when (and (string-not-empty-p root-directory) (when (and (string-not-empty-p root-directory)
(string-not-empty-p remote-dir)) (string-not-empty-p remote-dir))
(if (not (fs:directory-exists-p root-directory)) (if (not (fs:directory-exists-p root-directory))