mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
fix: use absolute paths for read-only files outside repo root
This commit is contained in:
parent
460311d49e
commit
6dc0b8d853
1 changed files with 6 additions and 2 deletions
|
@ -1285,8 +1285,12 @@ class Commands:
|
||||||
|
|
||||||
# Write commands to add read-only files
|
# Write commands to add read-only files
|
||||||
for fname in sorted(self.coder.abs_read_only_fnames):
|
for fname in sorted(self.coder.abs_read_only_fnames):
|
||||||
rel_fname = self.coder.get_rel_fname(fname)
|
# Use absolute path for files outside repo root, relative path for files inside
|
||||||
f.write(f"/read-only {rel_fname}\n")
|
if Path(fname).is_relative_to(self.coder.root):
|
||||||
|
rel_fname = self.coder.get_rel_fname(fname)
|
||||||
|
f.write(f"/read-only {rel_fname}\n")
|
||||||
|
else:
|
||||||
|
f.write(f"/read-only {fname}\n")
|
||||||
|
|
||||||
self.io.tool_output(f"Saved commands to {args.strip()}")
|
self.io.tool_output(f"Saved commands to {args.strip()}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue