@@ -139,5 +139,7 @@ contextBridge.exposeInMainWorld('apis', {
setZoomFactor (factor) {
webFrame.setZoomFactor(factor)
- }
+ },
+
+ isAbsolutePath: path.isAbsolute.bind(path)
})
@@ -138,9 +138,10 @@
([repo dir path]
(create-if-not-exists repo dir path ""))
([repo dir path initial-content]
- (let [path (if (util/starts-with? path "/")
- path
- (str "/" path))]
+ (let [path (if (util/is-absolute-path path) path
+ (if (util/starts-with? path "/")
+ path
+ (str "/" path)))]
(->
(p/let [stat (stat dir path)]
true)
@@ -1070,6 +1070,14 @@
(defonce win32? #?(:cljs goog.userAgent/WINDOWS
:clj nil))
+#?(:cljs
+ (defn is-absolute-path
+ [path]
+ (try
+ (js/window.apis.isAbsolutePath path)
+ (catch js/Error _
+ (node-path.isAbsolute path)))))
(defn ->system-modifier
[keyboard-shortcut]
(if mac?