mirror of https://github.com/logseq/logseq
parent
09a9cda59c
commit
307f7bd755
|
@ -70,7 +70,7 @@
|
|||
(p/let [result (ipc/ipc "writeFile" repo path content)
|
||||
mtime (gobj/get result "mtime")]
|
||||
(when-not contents-matched?
|
||||
(ipc/ipc "backupDbFile" (config/get-local-dir repo) path db-content content))
|
||||
(ipc/ipc "backupDbFile" (config/get-local-dir repo) path disk-content content))
|
||||
(db/set-file-last-modified-at! repo path mtime)
|
||||
(p/let [content (if (encrypt/encrypted-db? (state/get-current-repo))
|
||||
(encrypt/decrypt content)
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
(db/file-exists? repo path))
|
||||
(when-let [page-name (db/get-file-page path)]
|
||||
(println "Delete page: " page-name ", file path: " path ".")
|
||||
(page-handler/delete! page-name #() :delete-file? false))
|
||||
(page-handler/delete! page-name #() :unlink-file? true))
|
||||
|
||||
(and (contains? #{"add" "change" "unlink"} type)
|
||||
(string/ends-with? path "logseq/custom.css"))
|
||||
|
|
|
@ -160,19 +160,21 @@
|
|||
page-name)))
|
||||
|
||||
(defn delete-file!
|
||||
[repo page-name]
|
||||
[repo page-name unlink-file?]
|
||||
(let [file (db/get-page-file page-name)
|
||||
file-path (:file/path file)]
|
||||
;; delete file
|
||||
(when-not (string/blank? file-path)
|
||||
(db/transact! [[:db.fn/retractEntity [:file/path file-path]]])
|
||||
(->
|
||||
(p/let [_ (and (config/local-db? repo)
|
||||
(mobile-util/native-platform?)
|
||||
(fs/delete-file! repo file-path file-path {}))
|
||||
_ (fs/unlink! repo (config/get-repo-path repo file-path) nil)])
|
||||
(p/catch (fn [err]
|
||||
(js/console.error "error: " err)))))))
|
||||
(when unlink-file?
|
||||
(->
|
||||
(p/let [_ (and (config/local-db? repo)
|
||||
(mobile-util/native-platform?)
|
||||
;; TODO: @leizhe remove fs/delete-file! and use fs/unlink!
|
||||
(fs/delete-file! repo file-path file-path {}))
|
||||
_ (fs/unlink! repo (config/get-repo-path repo file-path) nil)])
|
||||
(p/catch (fn [err]
|
||||
(js/console.error "error: " err))))))))
|
||||
|
||||
(defn- compute-new-file-path
|
||||
[old-path new-name]
|
||||
|
@ -316,7 +318,7 @@
|
|||
page (db/entity [:block/name page-name])]
|
||||
(db/transact! tx-data)
|
||||
|
||||
(when delete-file? (delete-file! repo page-name))
|
||||
(delete-file! repo page-name delete-file?)
|
||||
|
||||
;; if other page alias this pagename,
|
||||
;; then just remove some attrs of this entity instead of retractEntity
|
||||
|
|
Loading…
Reference in New Issue