|
@@ -7,7 +7,6 @@
|
|
|
[clojure.edn :as edn]
|
|
|
[clojure.pprint :as pprint]
|
|
|
[clojure.string :as string]
|
|
|
- #_:clj-kondo/ignore
|
|
|
[logseq.db.sqlite.cli :as sqlite-cli]
|
|
|
[logseq.db.sqlite.export :as sqlite-export]
|
|
|
[nbb.core :as nbb]))
|
|
@@ -20,12 +19,14 @@
|
|
|
(node-path/join (or js/process.env.ORIGINAL_PWD ".") path)))
|
|
|
|
|
|
(defn- get-dir-and-db-name
|
|
|
- "Gets dir and db name for use with open-db!"
|
|
|
+ "Gets dir and db name for use with open-db! Works for relative and absolute paths and
|
|
|
+ defaults to ~/logseq/graphs/ when no '/' present in name"
|
|
|
[graph-dir]
|
|
|
(if (string/includes? graph-dir "/")
|
|
|
- (let [graph-dir'
|
|
|
- (node-path/join (or js/process.env.ORIGINAL_PWD ".") graph-dir)]
|
|
|
- ((juxt node-path/dirname node-path/basename) graph-dir'))
|
|
|
+ (let [resolve-path' #(if (node-path/isAbsolute %) %
|
|
|
+ ;; $ORIGINAL_PWD used by bb tasks to correct current dir
|
|
|
+ (node-path/join (or js/process.env.ORIGINAL_PWD ".") %))]
|
|
|
+ ((juxt node-path/dirname node-path/basename) (resolve-path' graph-dir)))
|
|
|
[(node-path/join (os/homedir) "logseq" "graphs") graph-dir]))
|
|
|
|
|
|
(def spec
|