summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/src/meshbay_cli/tui/chat.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/tui/chat.py')
-rw-r--r--packages/meshbay-cli/src/meshbay_cli/tui/chat.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/tui/chat.py b/packages/meshbay-cli/src/meshbay_cli/tui/chat.py
index e4ea1fe..989ffe2 100644
--- a/packages/meshbay-cli/src/meshbay_cli/tui/chat.py
+++ b/packages/meshbay-cli/src/meshbay_cli/tui/chat.py
@@ -21,6 +21,7 @@ import os
import time
from pathlib import Path
+from meshbay_common.paths import long_path
from rich.segment import Segment
from rich.text import Text
from textual import events
@@ -412,9 +413,10 @@ class ChatRoomScreen(Screen):
async def _put(self, arg: str) -> None:
path = Path(os.path.abspath(os.path.expanduser(arg)))
- if not path.is_file():
+ if not os.path.isfile(long_path(path)):
self.note(f"! {safe(arg)}: " + ("a folder; /put sends one file."
- if path.is_dir() else "no such file."), style="bold red")
+ if os.path.isdir(long_path(path)) else "no such file."),
+ style="bold red")
return
name = path.name
if problems := refused_names([name], []):
@@ -430,9 +432,9 @@ class ChatRoomScreen(Screen):
if found is None:
return
_, folder = found
- size = path.stat().st_size
+ size = os.stat(long_path(path)).st_size
advance, queued = self._progress("↑", name, size)
- with open(path, "rb") as fh:
+ with open(long_path(path), "rb") as fh:
def read(offset: int, length: int) -> bytes:
fh.seek(offset)
return fh.read(length)
@@ -475,7 +477,8 @@ class ChatRoomScreen(Screen):
style="bold red")
return
target = Path.cwd() / name.rsplit("/", 1)[-1]
- 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))):
self.note(f"! {safe(str(target))} is here already; nothing was downloaded.",
style="bold red")
return