Skip to content

Commit dc14347

Browse files
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 <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
1 parent 15d9ee1 commit dc14347

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

mempalace/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def cmd_split(args):
134134
import sys
135135

136136
# Rebuild argv for split_mega_files argparse
137-
argv = ["--source", args.dir]
137+
# Expand ~ and resolve to absolute path so split_mega_files sees a real path
138+
argv = ["--source", str(Path(args.dir).expanduser().resolve())]
138139
if args.output_dir:
139140
argv += ["--output-dir", args.output_dir]
140141
if args.dry_run:

mempalace/split_mega_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def main():
261261
)
262262
args = parser.parse_args()
263263

264-
src_dir = Path(args.source) if args.source else LUMI_DIR
264+
src_dir = Path(args.source).expanduser().resolve() if args.source else LUMI_DIR
265265
output_dir = args.output_dir or None # None = same dir as file
266266

267267
if args.file:

0 commit comments

Comments
 (0)