From feae729f98643131e93351cf865269d786f94320 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 23 Aug 2024 06:39:12 -0700 Subject: [PATCH] feat: Expand home directory in cmd_read_only --- aider/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aider/commands.py b/aider/commands.py index 3e7b5bbb1..fe91d902d 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1037,7 +1037,10 @@ class Commands: filenames = parse_quoted_filenames(args) for word in filenames: - abs_path = self.coder.abs_root_path(word) + # Expand the home directory if the path starts with "~" + expanded_path = os.path.expanduser(word) + abs_path = self.coder.abs_root_path(expanded_path) + if not os.path.exists(abs_path): self.io.tool_error(f"File not found: {abs_path}") continue