|
|
@@ -88,20 +88,7 @@
|
|
|
(p/recur (concat result files-result)
|
|
|
(concat (rest dirs) files-dir)))))
|
|
|
result (js->clj result :keywordize-keys true)]
|
|
|
- (if (util/native-ios?)
|
|
|
- result
|
|
|
- (map (fn [result] (update result :uri clean-uri)) result))))
|
|
|
-
|
|
|
-(defn- encode-path [orig-repo orig-path]
|
|
|
- (let [orig-repo (config/get-repo-dir orig-repo)
|
|
|
- [repo path] (map #(-> (string/replace % "file://" "")
|
|
|
- (string/replace "file:" "")
|
|
|
- (string/escape {\ "%20"}))
|
|
|
- [orig-repo orig-path])
|
|
|
- path-diff (string/replace path repo "")]
|
|
|
- (str orig-repo (-> path-diff
|
|
|
- futil/url-decode
|
|
|
- futil/url-encode))))
|
|
|
+ (map (fn [result] (update result :uri clean-uri)) result)))
|
|
|
|
|
|
(defrecord Capacitorfs []
|
|
|
protocol/Fs
|
|
|
@@ -142,28 +129,28 @@
|
|
|
(delete-file! [this repo dir path {:keys [ok-handler error-handler] :as opts}]
|
|
|
(let [path (cond
|
|
|
(= (util/platform) "ios")
|
|
|
- (encode-path repo path)
|
|
|
+ (js/encodeURI (js/decodeURI path))
|
|
|
|
|
|
(string/starts-with? path (config/get-repo-dir repo))
|
|
|
path
|
|
|
-
|
|
|
+
|
|
|
:else
|
|
|
(-> (str dir "/" path)
|
|
|
(string/replace "//" "/")))]
|
|
|
(p/catch
|
|
|
- (p/let [result (.deleteFile Filesystem
|
|
|
- (clj->js
|
|
|
- {:path path}))]
|
|
|
- (when ok-handler
|
|
|
- (ok-handler repo path result)))
|
|
|
- (fn [error]
|
|
|
- (if error-handler
|
|
|
- (error-handler error)
|
|
|
- (log/error :delete-file-failed error))))))
|
|
|
+ (p/let [result (.deleteFile Filesystem
|
|
|
+ (clj->js
|
|
|
+ {:path path}))]
|
|
|
+ (when ok-handler
|
|
|
+ (ok-handler repo path result)))
|
|
|
+ (fn [error]
|
|
|
+ (if error-handler
|
|
|
+ (error-handler error)
|
|
|
+ (log/error :delete-file-failed error))))))
|
|
|
(write-file! [this repo dir path content {:keys [ok-handler error-handler] :as opts}]
|
|
|
(let [path (cond
|
|
|
(= (util/platform) "ios")
|
|
|
- (encode-path repo path)
|
|
|
+ (js/encodeURI (js/decodeURI path))
|
|
|
|
|
|
(string/starts-with? path (config/get-repo-dir repo))
|
|
|
path
|