From d76f7a597e397d327ad46d3124aa98dacd0ff44e Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 2 Oct 2024 09:18:53 -0700 Subject: [PATCH] fix: handle tilde expansion in cmd_read_only for home directories --- aider/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider/commands.py b/aider/commands.py index 0b5272600..69fd6cd47 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -6,6 +6,7 @@ import sys import tempfile from collections import OrderedDict from pathlib import Path +from os.path import expanduser import pyperclip from PIL import Image, ImageGrab @@ -1139,7 +1140,10 @@ class Commands: filenames = parse_quoted_filenames(args) for pattern in filenames: - expanded_paths = glob.glob(pattern, recursive=True) + # Expand tilde for home directory + expanded_pattern = expanduser(pattern) + + expanded_paths = glob.glob(expanded_pattern, recursive=True) if not expanded_paths: self.io.tool_error(f"No matches found for: {pattern}") continue