From d0e35be7dca671cf50cf1faaa1d1908622cda95e Mon Sep 17 00:00:00 2001 From: Jerome Brown Date: Mon, 2 Jan 2023 13:18:47 +1300 Subject: [PATCH 1/2] Enable resoultion of variables in config paths --- CONTRIBUTORS.md | 1 + shallow_backup/backup.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5b355e47..35e2443d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -6,3 +6,4 @@ - [Peter Yasi](https://github.com/pyasi) - [Nicole Tibay](https://github.com/neequole) - [Rods](https://github.com/rods-honorio) +- [Jerome Brown](https://github.com/oWretch) diff --git a/shallow_backup/backup.py b/shallow_backup/backup.py index f3192e61..52b888ec 100644 --- a/shallow_backup/backup.py +++ b/shallow_backup/backup.py @@ -114,12 +114,13 @@ def backup_configs(backup_path, dry_run: bool = False, skip=False): continue quoted_dest = quote(dest) - if os.path.isdir(config_path): - copytree(config_path, quoted_dest, symlinks=True) - elif os.path.isfile(config_path): + expanded_path = os.path.expandvars(os.path.expanduser(config_path)) + if os.path.isdir(expanded_path): + copytree(expanded_path, quoted_dest, symlinks=True) + elif os.path.isfile(expanded_path): parent_dir = Path(dest).parent safe_mkdir(parent_dir) - copyfile(config_path, quoted_dest) + copyfile(expanded_path, quoted_dest) def backup_packages(backup_path, dry_run: bool = False, skip=False): From 0c3d53142f9aa9a2ce0bf99e7c99d71ce4d4a001 Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Tue, 24 Jan 2023 02:46:20 -0800 Subject: [PATCH 2/2] Update shallow_backup/backup.py --- shallow_backup/backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shallow_backup/backup.py b/shallow_backup/backup.py index 52b888ec..e1e0d530 100644 --- a/shallow_backup/backup.py +++ b/shallow_backup/backup.py @@ -114,7 +114,7 @@ def backup_configs(backup_path, dry_run: bool = False, skip=False): continue quoted_dest = quote(dest) - expanded_path = os.path.expandvars(os.path.expanduser(config_path)) + expanded_path = expand_to_abs_path(config_path) if os.path.isdir(expanded_path): copytree(expanded_path, quoted_dest, symlinks=True) elif os.path.isfile(expanded_path):