[Bugfix] Fix the backup file name generating function

This commit is contained in:
Gergely Polonkai 2018-08-07 14:33:32 +02:00
parent 91113931c7
commit 05e491cbbf

View File

@ -105,8 +105,8 @@ Taken from [[http://ergoemacs.org/emacs/emacs_set_backup_into_a_directory.html][
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun xah/backup-file-name (fpath) (defun xah/backup-file-name (fpath)
"Return a new file path for FPATH under `user-emacs-cache-directory'" "Return a new file path for FPATH under `user-emacs-cache-directory'"
(let* ((backup-root-dir (concat user-emacs-cache-directory "/backup")) (let* ((backup-root-dir (expand-file-name "backup" user-emacs-cache-directory))
(file-path (replace-regexp-in-string "[A-Za-z]:" "")) (file-path (replace-regexp-in-string "[A-Za-z]:" "" fpath))
(backup-file-path (replace-regexp-in-string "//" "/" (concat backup-root-dir file-path "~")))) (backup-file-path (replace-regexp-in-string "//" "/" (concat backup-root-dir file-path "~"))))
(make-directory (file-name-directory backup-file-path) (file-name-directory backup-file-path)) (make-directory (file-name-directory backup-file-path) (file-name-directory backup-file-path))
backup-file-path)) backup-file-path))