diff options
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/commands/get.py')
| -rw-r--r-- | packages/meshbay-cli/src/meshbay_cli/commands/get.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/commands/get.py b/packages/meshbay-cli/src/meshbay_cli/commands/get.py index eec73c4..33a9637 100644 --- a/packages/meshbay-cli/src/meshbay_cli/commands/get.py +++ b/packages/meshbay-cli/src/meshbay_cli/commands/get.py @@ -12,7 +12,7 @@ import os from dataclasses import dataclass from pathlib import Path -from meshbay_common.paths import fold +from meshbay_common.paths import fold, long_path from ..client.groups import my_groups from ..client.names import UnsafeName, local_path @@ -147,7 +147,8 @@ async def _run(ctx: Context, account, pool: Pool) -> int: planned.add(key) if changed: renamed.append((shown, target)) - if target.exists() and not target.with_name(target.name + PART_SUFFIX).exists(): + if os.path.exists(long_path(target)) and not os.path.exists( + long_path(target.with_name(target.name + PART_SUFFIX))): if a.skip: return if not a.force: @@ -181,7 +182,7 @@ async def _run(ctx: Context, account, pool: Pool) -> int: for problem in problems: progress.note(f"meshbay-cli: {safe(problem)}") for d in dirs: - d.mkdir(parents=True, exist_ok=True) + os.makedirs(long_path(d), exist_ok=True) progress.plan(len(jobs), sum(int(j.entry["size"]) for j in jobs)) failed = len(problems) @@ -224,12 +225,12 @@ def _destination(dest: str | None, single_file: bool) -> tuple[Path, str | None] return Path.cwd(), None path = Path(dest).expanduser() if dest.endswith(("/", os.sep)): - path.mkdir(parents=True, exist_ok=True) + os.makedirs(long_path(path), exist_ok=True) return path, None - if path.is_dir(): + if os.path.isdir(long_path(path)): return path, None if single_file: - if not path.parent.is_dir(): + if not os.path.isdir(long_path(path.parent)): raise CliError(USAGE, f"{path.parent} is not a folder.") return path.parent, path.name raise CliError(USAGE, f"{dest} is not a folder (end it with / to create it).") |