From aad09df55ca87e73bd409f3ad7e6afba39210905 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Wed, 27 Jan 2021 21:25:09 +0800 Subject: [PATCH] feat(electron): fix win32 path --- src/main/frontend/handler/file.cljs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/frontend/handler/file.cljs b/src/main/frontend/handler/file.cljs index 584e568206..6e5e0111e6 100644 --- a/src/main/frontend/handler/file.cljs +++ b/src/main/frontend/handler/file.cljs @@ -25,7 +25,8 @@ [cljs-time.core :as t] [cljs-time.coerce :as tc] [frontend.utf8 :as utf8] - ["ignore" :as Ignore])) + ["ignore" :as Ignore] + ["/frontend/utils" :as utils])) ;; TODO: extract all git ops using a channel @@ -129,10 +130,16 @@ (defn reset-file! [repo-url file content] - (let [file (if (and (util/electron?) - (config/local-db? repo-url) - (not= "/" (first file))) + (let [electron-local-repo? (and (util/electron?) + (config/local-db? repo-url)) + file (cond + (and electron-local-repo? (util/win32?)) + file + + electron-local-repo? (str (config/get-repo-dir repo-url) "/" file) + + :else file) new? (nil? (db/entity [:file/path file]))] (db/set-file-content! repo-url file content)