Skip to content

Commit

Permalink
Backup dotfolders correctly. Release v2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
alichtman committed Oct 16, 2019
1 parent a5bec6f commit c87ab1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions shallow_backup/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def backup_dotfiles(backup_dest_path, home_path=os.path.expanduser("~"), skip=Fa
dotfolders_mp_in = []
for dotfolder in [os.path.join(home_path, folder) for folder in config["dotfolders"]]:
if os.path.isdir(dotfolder):
dotfolders_mp_in.append((quote(dotfolder), backup_dest_path))
dest_path_nested_dir = os.path.join(backup_dest_path, dotfolder.replace(home_path + "/", ""))
dotfolders_mp_in.append((quote(dotfolder), quote(dest_path_nested_dir)))

dotfiles_mp_in = []
for dotfile in config["dotfiles"]:
Expand All @@ -37,7 +38,7 @@ def backup_dotfiles(backup_dest_path, home_path=os.path.expanduser("~"), skip=Fa
dotfiles_mp_in.append((quote(full_dotfile_path), dest_path))

# Fix https://github.com/alichtman/shallow-backup/issues/230
for dest_path in [path_pair[1] for path_pair in dotfiles_mp_in]:
for dest_path in [path_pair[1] for path_pair in dotfiles_mp_in + dotfolders_mp_in]:
create_dir_if_doesnt_exist(os.path.split(dest_path)[0])

with mp.Pool(mp.cpu_count()):
Expand Down
2 changes: 1 addition & 1 deletion shallow_backup/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class ProjInfo:
PROJECT_NAME = 'shallow-backup'
VERSION = '2.7'
VERSION = '2.8'
AUTHOR_GITHUB = 'alichtman'
AUTHOR_FULL_NAME = 'Aaron Lichtman'
DESCRIPTION = "Easily create lightweight backups of installed packages, dotfiles, and more."
Expand Down
3 changes: 1 addition & 2 deletions shallow_backup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def copy_dir_if_valid(source_dir, backup_path):
invalid = {".Trash", ".npm", ".cache", ".rvm"}
if len(invalid.intersection(set(source_dir.split("/")))) != 0:
return
dest = os.path.join(backup_path, os.path.split(source_dir)[-1])
copytree(source_dir, dest, symlinks=True)
copytree(source_dir, backup_path, symlinks=True)


def home_prefix(path):
Expand Down

0 comments on commit c87ab1b

Please sign in to comment.