fix(mobile): bak files

This commit is contained in:
charlie
2022-08-17 17:15:44 +08:00
committed by Andelf
parent 5373da2deb
commit 005719cb06
3 changed files with 16 additions and 13 deletions

View File

@@ -37,10 +37,13 @@
[repo path content db-content mtime backup?]
(p/let [
;; save the previous content in a versioned bak file to avoid data overwritten.
_ (when-let [repo-dir (and backup? (config/get-local-dir repo))]
(if (util/electron?)
(ipc/ipc "backupDbFile" repo-dir path db-content content)
(capacitor-fs/backup-file-handle-changed! repo-dir path db-content)))
_ (-> (when-let [repo-dir (and backup? (config/get-local-dir repo))]
(prn "⚠Bak File: " path)
(if (util/electron?)
(ipc/ipc "backupDbFile" repo-dir path db-content content)
(capacitor-fs/backup-file-handle-changed! repo-dir path db-content)))
(p/catch #(js/console.error "❌ Bak Error: " path %)))
_ (file-handler/alter-file repo path content {:re-render-root? true
:from-disk? true})]
(set-missing-block-ids! content)