mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-26 09:27:36 +01:00
- [kami] prevented crash when downloading fails, notify an error instead.
This commit is contained in:
parent
283930efef
commit
444f7939ce
@ -2525,18 +2525,21 @@ 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)
|
||||||
(when (string-not-empty-p destination-file)
|
(with-notify-errors
|
||||||
(with-enqueued-process ()
|
(fstree:download-path win path destination-file)))
|
||||||
(when (not (fs:file-exists-p destination-file))
|
(on-input-complete (destination-file)
|
||||||
(fs:create-file output-file))
|
(when (string-not-empty-p destination-file)
|
||||||
(if notify
|
(with-enqueued-process ()
|
||||||
(with-blocking-notify-procedure
|
(when (not (fs:file-exists-p destination-file))
|
||||||
((format nil (_ "Starting download of ~a") path)
|
(fs:create-file output-file))
|
||||||
(format nil (_ "Download completed in ~a") destination-file))
|
(if notify
|
||||||
(fstree:download-path win path destination-file)
|
(with-blocking-notify-procedure
|
||||||
(info-message destination-file))
|
((format nil (_ "Starting download of ~a") path)
|
||||||
(fstree:download-path win path destination-file))))))
|
(format nil (_ "Download completed in ~a") destination-file))
|
||||||
|
(%download win path destination-file)
|
||||||
|
(info-message 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
|
||||||
@ -2852,16 +2855,17 @@ Note: existing file will be overwritten."
|
|||||||
(when-let* ((win *filesystem-explorer-window*)
|
(when-let* ((win *filesystem-explorer-window*)
|
||||||
(fields (line-oriented-window:selected-row-fields win))
|
(fields (line-oriented-window:selected-row-fields win))
|
||||||
(remote-dir (and (fs:path-referencing-dir-p (fstree:tree-path fields))
|
(remote-dir (and (fs:path-referencing-dir-p (fstree:tree-path fields))
|
||||||
(fstree:tree-path fields)))
|
(fstree:tree-path fields)))
|
||||||
(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))
|
||||||
(error-message (format nil "~a is not directory" root-directory))
|
(error-message (format nil "~a is not directory" root-directory))
|
||||||
(let* ((remote-paths (funcall (fstree:filesystem-collect-tree win)
|
(let* ((remote-paths (funcall (fstree:filesystem-collect-tree win)
|
||||||
remote-dir))
|
remote-dir))
|
||||||
(local-paths
|
(local-paths
|
||||||
(mapcar (lambda (a) (fs:cat-parent-dir root-directory a))
|
(mapcar (lambda (a) (fs:cat-parent-dir root-directory a))
|
||||||
remote-paths)))
|
remote-paths)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user