|
@@ -89,25 +89,6 @@
|
|
|
(remove nil?))]
|
|
|
(vec (cons {:path (fix-win-path! path)} result))))
|
|
|
|
|
|
-(defn- get-ls-dotdir-root
|
|
|
- []
|
|
|
- (let [lg-dir (str (.getPath app "home") "/.logseq")]
|
|
|
- (if-not (fs/existsSync lg-dir)
|
|
|
- (and (fs/mkdirSync lg-dir) lg-dir)
|
|
|
- lg-dir)))
|
|
|
-
|
|
|
-(defn- get-ls-default-plugins
|
|
|
- []
|
|
|
- (let [plugins-root (path/join (get-ls-dotdir-root) "plugins")
|
|
|
- _ (if-not (fs/existsSync plugins-root)
|
|
|
- (fs/mkdirSync plugins-root))
|
|
|
- dirs (js->clj (fs/readdirSync plugins-root #js{"withFileTypes" true}))
|
|
|
- dirs (->> dirs
|
|
|
- (filter #(.isDirectory %))
|
|
|
- (filter #(not (string/starts-with? (.-name %) "_")))
|
|
|
- (map #(path/join plugins-root (.-name %))))]
|
|
|
- dirs))
|
|
|
-
|
|
|
(defmethod handle :openDir [^js window _messages]
|
|
|
(let [result (.showOpenDialogSync dialog (bean/->js
|
|
|
{:properties ["openDirectory" "createDirectory" "promptToCreate"]}))
|
|
@@ -197,18 +178,6 @@
|
|
|
(when dir
|
|
|
(watch-dir! window dir)))
|
|
|
|
|
|
-(defmethod handle :openDialogSync [^js window _messages]
|
|
|
- (let [result (.showOpenDialogSync dialog (bean/->js
|
|
|
- {:properties ["openDirectory"]}))
|
|
|
- path (first result)]
|
|
|
- path))
|
|
|
-
|
|
|
-(defmethod handle :getLogseqDotDirRoot []
|
|
|
- (get-ls-dotdir-root))
|
|
|
-
|
|
|
-(defmethod handle :getUserDefaultPlugins []
|
|
|
- (get-ls-default-plugins))
|
|
|
-
|
|
|
(defmethod handle :default [args]
|
|
|
(println "Error: no ipc handler for: " (bean/->js args)))
|
|
|
|