|
@@ -5,37 +5,21 @@
|
|
|
[promesa.core :as p]
|
|
[promesa.core :as p]
|
|
|
[electron.ipc :as ipc]))
|
|
[electron.ipc :as ipc]))
|
|
|
|
|
|
|
|
-;; (defonce fs (when (util/electron?)
|
|
|
|
|
-;; (js/require "fs")))
|
|
|
|
|
-
|
|
|
|
|
-;; (defonce path (when (util/electron?)
|
|
|
|
|
-;; (js/require "path")))
|
|
|
|
|
-
|
|
|
|
|
-;; (defn ls-dir [dir]
|
|
|
|
|
-;; (->> (tree-seq
|
|
|
|
|
-;; (fn [f] (.isDirectory (.statSync fs f) ()))
|
|
|
|
|
-;; (fn [d] (map #(.join path d %) (.readdirSync fs d)))
|
|
|
|
|
-;; dir)
|
|
|
|
|
-;; (apply concat)
|
|
|
|
|
-;; (doall)))
|
|
|
|
|
-
|
|
|
|
|
(defrecord Node []
|
|
(defrecord Node []
|
|
|
protocol/Fs
|
|
protocol/Fs
|
|
|
(mkdir! [this dir]
|
|
(mkdir! [this dir]
|
|
|
- (ipc/ipc "mkdir" {:path dir}))
|
|
|
|
|
|
|
+ (ipc/ipc "mkdir" dir))
|
|
|
(readdir [this dir] ; recursive
|
|
(readdir [this dir] ; recursive
|
|
|
- (ipc/ipc "readdir" {:dir dir}))
|
|
|
|
|
|
|
+ (ipc/ipc "readdir" dir))
|
|
|
(unlink! [this path _opts]
|
|
(unlink! [this path _opts]
|
|
|
- (ipc/ipc "unlink" {:path path}))
|
|
|
|
|
|
|
+ (ipc/ipc "unlink" path))
|
|
|
(rmdir! [this dir]
|
|
(rmdir! [this dir]
|
|
|
nil)
|
|
nil)
|
|
|
(read-file [this dir path]
|
|
(read-file [this dir path]
|
|
|
- (ipc/ipc "readFile" {:path (str dir "/" path)}))
|
|
|
|
|
- (write-file! [this repo dir path content opts]
|
|
|
|
|
- (ipc/ipc "writeFile" {:path (str dir "/" path)
|
|
|
|
|
- :content content}))
|
|
|
|
|
|
|
+ (ipc/ipc "readFile" (str dir "/" path)))
|
|
|
|
|
+ (write-file! [this repo dir path content _opts]
|
|
|
|
|
+ (ipc/ipc "writeFile" (str dir "/" path) content))
|
|
|
(rename! [this repo old-path new-path]
|
|
(rename! [this repo old-path new-path]
|
|
|
- (ipc/ipc "rename" {:old-path old-path
|
|
|
|
|
- :new-path new-path}))
|
|
|
|
|
|
|
+ (ipc/ipc "rename" old-path new-path))
|
|
|
(stat [this dir path]
|
|
(stat [this dir path]
|
|
|
- (ipc/ipc "stat" {:path (str dir path)})))
|
|
|
|
|
|
|
+ (ipc/ipc "stat" (str dir path))))
|