diff --git a/src/main/frontend/fs/capacitor_fs.cljs b/src/main/frontend/fs/capacitor_fs.cljs index d3c9e64ff1..baa98903a2 100644 --- a/src/main/frontend/fs/capacitor_fs.cljs +++ b/src/main/frontend/fs/capacitor_fs.cljs @@ -82,7 +82,7 @@ (p/let [d (first dirs) files (> files - (remove (fn [{:keys [name type] :as file-info}] + (remove (fn [{:keys [name type]}] (or (string/starts-with? name ".") (and (= type "directory") (or (= name "bak") @@ -211,7 +211,7 @@ (defn get-file-path [dir path] (let [dir (some-> dir (string/replace #"/+$" "")) - dir (if (string/starts-with? dir "/") + dir (if (and (not-empty dir) (string/starts-with? dir "/")) (do (js/console.trace "WARN: detect absolute path, use URL instead") (str "file://" (js/encodeURI dir))) @@ -261,13 +261,18 @@ (log/error :mkdir! {:path dir :error error}))))) (mkdir-recur! [_this dir] - (p/let [result (.mkdir Filesystem - (clj->js - {:path dir - ;; :directory (.-ExternalStorage Directory) - :recursive true}))] - (js/console.log result) - result)) + (p/let + [_ (-> (.mkdir Filesystem + (clj->js + {:path dir + :recursive true})) + (p/catch (fn [error] + (log/error :mkdir-recur! {:path dir + :error error})))) + stat ( (string/replace path repo-url "") (string/replace "/" "_") (string/replace "\\" "_")) - new-path (str recycle-dir "/" file-name)] - (protocol/mkdir! this recycle-dir) + new-path (str recycle-dir "/" file-name) + _ (protocol/mkdir-recur! this recycle-dir)] (protocol/rename! this repo path new-path))) (rmdir! [_this _dir] ;; Too dangerous!!! We'll never implement this. @@ -320,11 +325,7 @@ (log/error :copy-file-failed error))))) (stat [_this dir path] (let [path (get-file-path dir path)] - (p/let [result (.stat Filesystem (clj->js - {:path path - ;; :directory (.-ExternalStorage Directory) - }))] - result))) + ( (.pickFolder mobile-util/folder-picker)