mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix(fs): mock dir handling, fix e2e tests
This commit is contained in:
@@ -211,7 +211,9 @@
|
||||
|
||||
(defmethod handle :getFiles [_window [_ path]]
|
||||
(logger/debug ::get-files {:path path})
|
||||
(get-files path))
|
||||
(p/let [files (get-files path)]
|
||||
(bean/->js {:path path
|
||||
:files files})))
|
||||
|
||||
(defn- sanitize-graph-name
|
||||
[graph-name]
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
files (mapv (fn [entry]
|
||||
(assoc entry :path (path/relative-path dir (:path entry))))
|
||||
files)]
|
||||
{:path dir :files files})))))
|
||||
{:path path :files files})))))
|
||||
|
||||
(defn get-files
|
||||
"List all files in the directory, recursively.
|
||||
|
||||
@@ -71,9 +71,11 @@
|
||||
[dir]
|
||||
(p/let [dir-path (or dir (util/mocked-open-dir-path))
|
||||
result (if dir-path
|
||||
(ipc/ipc "getFiles" dir-path)
|
||||
(ipc/ipc "openDir" {}))]
|
||||
(prn ::open-dir result)
|
||||
(do
|
||||
(println "NOTE: Using mocked dir" dir-path)
|
||||
(ipc/ipc "getFiles" dir-path))
|
||||
(ipc/ipc "openDir" {}))
|
||||
result (bean/->clj result)]
|
||||
result))
|
||||
|
||||
(defrecord Node []
|
||||
@@ -111,8 +113,7 @@
|
||||
(-> (ipc/ipc "stat" fpath)
|
||||
(p/then bean/->clj)))
|
||||
(open-dir [_this dir]
|
||||
(p/then (open-dir dir)
|
||||
bean/->clj))
|
||||
(open-dir dir))
|
||||
(get-files [_this dir]
|
||||
(-> (ipc/ipc "getFiles" dir)
|
||||
(p/then bean/->clj)))
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
[repo-url {:keys [file-objs new-graph? empty-graph?]}]
|
||||
(spec/validate :repos/url repo-url)
|
||||
(route-handler/redirect-to-home!)
|
||||
(prn ::load---new-file-objs repo-url)
|
||||
(prn ::load-new-repo repo-url :empty-graph? empty-graph? :new-graph? new-graph?)
|
||||
(state/set-parsing-state! {:graph-loading? true})
|
||||
(let [repo-dir (config/get-local-dir repo-url)
|
||||
_ (prn ::repo-dir repo-dir)
|
||||
|
||||
Reference in New Issue
Block a user