From dc143471bcb8369efffa1c2e7d1a09219ac27ed2 Mon Sep 17 00:00:00 2001 From: Brooke Whatnall <153066110+brookewhatnall@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:14:28 +1200 Subject: [PATCH] fix: expand ~ in split command directory argument (#361) Path("~/foo") does not expand tilde on its own, causing `mempalace split ~/some/dir` to silently find no files. Fix by calling .expanduser().resolve() in both places the path is constructed: cmd_split in cli.py (defensive, at the CLI boundary) and main() in split_mega_files.py (the root cause). Co-authored-by: Brooke Whatnall Co-authored-by: Claude Sonnet 4.6 --- mempalace/cli.py | 3 ++- mempalace/split_mega_files.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mempalace/cli.py b/mempalace/cli.py index 1b59f0b..803719d 100644 --- a/mempalace/cli.py +++ b/mempalace/cli.py @@ -134,7 +134,8 @@ def cmd_split(args): import sys # Rebuild argv for split_mega_files argparse - argv = ["--source", args.dir] + # Expand ~ and resolve to absolute path so split_mega_files sees a real path + argv = ["--source", str(Path(args.dir).expanduser().resolve())] if args.output_dir: argv += ["--output-dir", args.output_dir] if args.dry_run: diff --git a/mempalace/split_mega_files.py b/mempalace/split_mega_files.py index 24b5956..f57beca 100644 --- a/mempalace/split_mega_files.py +++ b/mempalace/split_mega_files.py @@ -261,7 +261,7 @@ def main(): ) args = parser.parse_args() - src_dir = Path(args.source) if args.source else LUMI_DIR + src_dir = Path(args.source).expanduser().resolve() if args.source else LUMI_DIR output_dir = args.output_dir or None # None = same dir as file if args.file: