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 <brookewhatnall@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -134,7 +134,8 @@ def cmd_split(args):
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Rebuild argv for split_mega_files argparse
|
# 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:
|
if args.output_dir:
|
||||||
argv += ["--output-dir", args.output_dir]
|
argv += ["--output-dir", args.output_dir]
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ def main():
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
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
|
output_dir = args.output_dir or None # None = same dir as file
|
||||||
|
|
||||||
if args.file:
|
if args.file:
|
||||||
|
|||||||
Reference in New Issue
Block a user