|
|
@@ -1,9 +1,9 @@
|
|
|
(ns electron.configs
|
|
|
- (:require
|
|
|
- ["fs-extra" :as ^js fs]
|
|
|
- ["path" :as ^js node-path]
|
|
|
- ["electron" :refer [^js app] :as electron]
|
|
|
- [cljs.reader :as reader]))
|
|
|
+ (:require ["electron" :refer [^js app] :as electron]
|
|
|
+ ["fs-extra" :as ^js fs]
|
|
|
+ ["path" :as ^js node-path]
|
|
|
+ [cljs.reader :as reader]
|
|
|
+ [electron.logger :as logger]))
|
|
|
|
|
|
;; FIXME: move configs.edn to where it should be
|
|
|
(defonce dot-root (.join node-path (.getPath app "home") ".logseq"))
|
|
|
@@ -17,14 +17,14 @@
|
|
|
(let [body (.toString (.readFileSync fs cfg-path))]
|
|
|
(if (seq body) (reader/read-string body) {}))
|
|
|
(catch :default e
|
|
|
- (js/console.error :cfg-error e))))
|
|
|
+ (logger/error :cfg-error e))))
|
|
|
|
|
|
(defn- write-cfg!
|
|
|
[cfg]
|
|
|
(try
|
|
|
(.writeFileSync fs cfg-path (pr-str cfg)) cfg
|
|
|
(catch :default e
|
|
|
- (js/console.error :cfg-error e))))
|
|
|
+ (logger/error :cfg-error e))))
|
|
|
|
|
|
(defn set-item!
|
|
|
[k v]
|