mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: Handle non-existent files in apply_edits
This commit is contained in:
parent
210d313d52
commit
25c36503ff
1 changed files with 10 additions and 0 deletions
|
@ -1658,4 +1658,14 @@ class Coder:
|
|||
return []
|
||||
|
||||
def apply_edits(self, edits):
|
||||
for edit in edits:
|
||||
path, content = edit
|
||||
full_path = self.abs_root_path(path)
|
||||
if not os.path.exists(full_path):
|
||||
self.io.tool_error(f"Error: File {path} does not exist. Skipping edits.")
|
||||
continue
|
||||
|
||||
if not self.dry_run:
|
||||
with open(full_path, 'w', encoding=self.io.encoding) as f:
|
||||
f.write(content)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue