From 046e47d22e5c11777a2da111744ad8cbd2bbe4e6 Mon Sep 17 00:00:00 2001 From: Andelf Date: Thu, 2 Mar 2023 11:17:49 +0800 Subject: [PATCH] fix(electron): global config dir name under windows --- src/electron/electron/utils.cljs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/electron/electron/utils.cljs b/src/electron/electron/utils.cljs index 73673b4ccc..8cbc197caf 100644 --- a/src/electron/electron/utils.cljs +++ b/src/electron/electron/utils.cljs @@ -35,12 +35,19 @@ ([url options] (_fetch url (bean/->js (merge options {:agent @*fetchAgent}))))) +(defn fix-win-path! + [path] + (when path + (if win32? + (string/replace path "\\" "/") + path))) + (defn get-ls-dotdir-root [] (let [lg-dir (path/join (.getPath app "home") ".logseq")] - (if-not (fs/existsSync lg-dir) - (do (fs/mkdirSync lg-dir) lg-dir) - lg-dir))) + (when-not (fs/existsSync lg-dir) + (fs/mkdirSync lg-dir)) + (fix-win-path! lg-dir))) (defn get-ls-default-plugins [] @@ -214,13 +221,6 @@ (let [ext (string/lower-case (path/extname path))] (contains? #{".md" ".markdown" ".org" ".js" ".edn" ".css"} ext))) -(defn fix-win-path! - [path] - (when path - (if win32? - (string/replace path "\\" "/") - path))) - (defn read-file [path] (try