Skip to content

Commit

Permalink
fix(electron): initial warning of local dir
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Mar 28, 2023
1 parent 669f082 commit 72a290d
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deps/common/src/logseq/common/path.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

(cond
(nil? base)
(js/console.error "path join global directory" segments)
(js/console.log "path join global directory" segments)
(= base "")
(js/console.error "BUG: should not join with empty dir" segments)
:else
Expand Down
1 change: 0 additions & 1 deletion deps/graph-parser/src/logseq/graph_parser/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

(defn remove-asset-protocol
[s]
(js/console.error "BUG: remove-asset-protocol")
(if (local-protocol-asset? s)
(-> s
(string/replace-first asset-protocol "")
Expand Down
3 changes: 2 additions & 1 deletion src/electron/electron/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@
(defn get-graph-dir
"required by all internal state in the electron section"
[graph-name]
(string/replace graph-name "logseq_local_" ""))
(when (string/includes? graph-name "logseq_local_")
(string/replace-first graph-name "logseq_local_" "")))

(defn get-graph-name
"reversing `get-graph-dir`"
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
(rum/mount (page/current-page) node)
(display-welcome-message)
;; NO repo state here, better not add init logic here
))
(when config/dev?
(js/setTimeout #(sync/<sync-start) 1000))))

(defn ^:export init []
;; init is called ONCE when the page loads
Expand Down
2 changes: 0 additions & 2 deletions src/main/frontend/handler.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@
(when (util/electron?)
(el/listen!))
(persist-var/load-vars)
(when config/dev?
(js/setTimeout #(sync/<sync-start) 1000))
(js/setTimeout instrument! (* 60 1000))))

(defn stop! []
Expand Down
3 changes: 1 addition & 2 deletions src/main/frontend/handler/editor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,10 +1458,9 @@
(let [repo (state/get-current-repo)
repo-dir (config/get-repo-dir repo)
;; Hack for path calculation
path (str "./" (string/replace path "../" "/"))
path (string/replace path #"^(\\.\\.)?/" "./")
full-path (path/path-join repo-dir path)
data-url? (string/starts-with? path "data:")]
(prn ::make-asset-url full-path path)
(cond
data-url?
path ;; just return the original
Expand Down
1 change: 0 additions & 1 deletion src/main/frontend/state.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ Similar to re-frame subscriptions"

(defn set-current-repo!
[repo]
(prn ::set-current-rep repo)
(swap! state assoc :git/current-repo repo)
(if repo
(storage/set :git/current-repo repo)
Expand Down

0 comments on commit 72a290d

Please sign in to comment.