Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fs): missing mkdir-recur! for nfs and memory-fs #10497

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/frontend/fs/memory_fs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
(let [fpath (path/url-to-path dir)]
(-> (js/window.pfs.mkdir fpath)
(p/catch (fn [error] (println "(memory-fs)Mkdir error: " error)))))))

(mkdir-recur! [_this dir]
(when js/window.pfs
(let [fpath (path/url-to-path dir)]
(-> (js/window.pfs.mkdir fpath #js {:recursive true})
(p/catch (fn [error] (println "(memory-fs)Mkdir-recur error: " error)))))))

(readdir [_this dir]
(when js/window.pfs
(let [fpath (path/url-to-path dir)]
Expand Down Expand Up @@ -82,8 +89,7 @@
_ (<ensure-dir! containing-dir)
_ (js/window.pfs.writeFile fpath content)]
(db/set-file-content! repo rpath content)
(db/set-file-last-modified-at! repo rpath (js/Date.))
))
(db/set-file-last-modified-at! repo rpath (js/Date.))))
(rename! [_this _repo old-path new-path]
(let [old-path (path/url-to-path old-path)
new-path (path/url-to-path new-path)]
Expand Down
3 changes: 3 additions & 0 deletions src/main/frontend/fs/nfs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
(js/console.debug "mkdir error: " error ", dir: " dir)
(throw error))))))

(mkdir-recur! [this dir]
(protocol/mkdir! this dir))

(readdir [_this dir]
;; This method is only used for repo-dir and version-files dir
;; There's no Logseq Sync support for nfs. So assume dir is always a repo dir.
Expand Down