mirror of
https://github.com/logseq/logseq.git
synced 2026-04-26 15:15:01 +00:00
fix: readdir
also, fix warnings on persist var
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
(defn- <readdir [path]
|
||||
(-> (p/chain (.readdir Filesystem (clj->js {:path path}))
|
||||
#(js->clj % :keywordize-keys true)
|
||||
#(get % "files" nil))
|
||||
:files)
|
||||
(p/catch (fn [error]
|
||||
(js/console.error "readdir Error: " path ": " error)
|
||||
nil))))
|
||||
@@ -83,25 +83,26 @@
|
||||
files (<readdir d)
|
||||
files (->> files
|
||||
(remove (fn [file]
|
||||
(let [uri (:uri file)]
|
||||
(or (string/starts-with? uri ".")
|
||||
(= file "bak"))))))
|
||||
files (map (fn [file]
|
||||
;; TODO: use uri-join
|
||||
(update file :uri
|
||||
(fn [uri]
|
||||
(str (string/replace d #"/+$" "")
|
||||
"/"
|
||||
(if (mobile-util/native-ios?)
|
||||
(js/encodeURI uri)
|
||||
uri)))))
|
||||
files)
|
||||
files-dir (->> files
|
||||
(or (string/starts-with? file ".")
|
||||
(and (mobile-util/native-android?)
|
||||
(or (string/includes? file "#")
|
||||
(string/includes? file "%")))
|
||||
(= file "bak")))))
|
||||
files (->> files
|
||||
(map (fn [file]
|
||||
;; TODO: use uri-join
|
||||
(str (string/replace d #"/+$" "")
|
||||
"/"
|
||||
(if (mobile-util/native-ios?)
|
||||
(js/encodeURI file)
|
||||
file)))))
|
||||
files-with-stats (p/all (mapv <stat files))
|
||||
files-dir (->> files-with-stats
|
||||
(filterv #(= (:type %) "directory"))
|
||||
(mapv :uri))
|
||||
files-result
|
||||
(p/all
|
||||
(->> files
|
||||
(->> files-with-stats
|
||||
(filter #(= (:type %) "file"))
|
||||
(filter
|
||||
(fn [{:keys [uri]}]
|
||||
|
||||
Reference in New Issue
Block a user