diff --git a/shallow_backup/backup.py b/shallow_backup/backup.py index 72079ef2..f0ed5d86 100644 --- a/shallow_backup/backup.py +++ b/shallow_backup/backup.py @@ -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"]: @@ -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()): diff --git a/shallow_backup/constants.py b/shallow_backup/constants.py index cf57df2e..195b0042 100644 --- a/shallow_backup/constants.py +++ b/shallow_backup/constants.py @@ -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." diff --git a/shallow_backup/utils.py b/shallow_backup/utils.py index d577744c..e75dc7a6 100644 --- a/shallow_backup/utils.py +++ b/shallow_backup/utils.py @@ -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):