|
|
@@ -17,44 +17,44 @@
|
|
|
"Ignore path for ls-dir-files-with-handler! and reload-dir!"
|
|
|
[dir path]
|
|
|
(let [ignores ["." ".recycle" "node_modules" "logseq/bak"
|
|
|
- "logseq/version-files" "logseq/graphs-txid.edn"]]
|
|
|
+ "logseq/version-files" "logseq/graphs-txid.edn"]]
|
|
|
(when (string? path)
|
|
|
- (or
|
|
|
- (some #(string/starts-with? path (str dir "/" %)) ignores)
|
|
|
- (some #(string/includes? path (str "/" % "/")) ignores)
|
|
|
- (some #(string/ends-with? path %)
|
|
|
- [".DS_Store" "logseq/graphs-txid.edn" "logseq/broken-config.edn"])
|
|
|
+ (or
|
|
|
+ (some #(string/starts-with? path (str dir "/" %)) ignores)
|
|
|
+ (some #(string/includes? path (str "/" % "/")) ignores)
|
|
|
+ (some #(string/ends-with? path %)
|
|
|
+ [".DS_Store" "logseq/graphs-txid.edn" "logseq/broken-config.edn"])
|
|
|
;; hidden directory or file
|
|
|
- (let [relpath (path/relative dir path)]
|
|
|
- (or (re-find #"/\.[^.]+" relpath)
|
|
|
- (re-find #"^\.[^.]+" relpath)))
|
|
|
- (let [path (string/lower-case path)]
|
|
|
- (and
|
|
|
- (not (string/blank? (path/extname path)))
|
|
|
- (not
|
|
|
- (some #(string/ends-with? path %)
|
|
|
- [".md" ".markdown" ".org" ".js" ".edn" ".css"]))))))))
|
|
|
+ (let [relpath (path/relative dir path)]
|
|
|
+ (or (re-find #"/\.[^.]+" relpath)
|
|
|
+ (re-find #"^\.[^.]+" relpath)))
|
|
|
+ (let [path (string/lower-case path)]
|
|
|
+ (and
|
|
|
+ (not (string/blank? (path/extname path)))
|
|
|
+ (not
|
|
|
+ (some #(string/ends-with? path %)
|
|
|
+ [".md" ".markdown" ".org" ".js" ".edn" ".css"]))))))))
|
|
|
|
|
|
-(defn read-graph-txid-info
|
|
|
+(defn read-graphs-txid-info
|
|
|
[root]
|
|
|
(when (string? root)
|
|
|
(-> (p/let [txid-str (fs/read-file root "logseq/graphs-txid.edn")
|
|
|
txid-meta (and txid-str (reader/read-string txid-str))]
|
|
|
- txid-meta)
|
|
|
+ txid-meta)
|
|
|
(p/catch
|
|
|
- (fn [^js e]
|
|
|
- (js/console.error "[fs read txid data error]" e))))))
|
|
|
+ (fn [^js e]
|
|
|
+ (js/console.error "[fs read txid data error]" e))))))
|
|
|
|
|
|
(defn inflate-graphs-info
|
|
|
[graphs]
|
|
|
(if (seq graphs)
|
|
|
(p/all (for [{:keys [root] :as graph} graphs]
|
|
|
- (p/let [sync-meta (read-graph-txid-info root)]
|
|
|
- (if sync-meta
|
|
|
- (assoc graph
|
|
|
- :sync-meta sync-meta
|
|
|
- :GraphUUID (second sync-meta))
|
|
|
- graph))))
|
|
|
+ (p/let [sync-meta (read-graphs-txid-info root)]
|
|
|
+ (if sync-meta
|
|
|
+ (assoc graph
|
|
|
+ :sync-meta sync-meta
|
|
|
+ :GraphUUID (second sync-meta))
|
|
|
+ graph))))
|
|
|
[]))
|
|
|
|
|
|
(defn read-repo-file
|