fix: handle ValueError in os.path.relpath calls

This commit is contained in:
Paul Gauthier (aider) 2024-09-04 14:10:56 -07:00
parent 937a1cd847
commit 6152a82513
2 changed files with 8 additions and 2 deletions

View file

@ -1624,7 +1624,10 @@ class Coder:
return cur + new
def get_rel_fname(self, fname):
return os.path.relpath(fname, self.root)
try:
return os.path.relpath(fname, self.root)
except ValueError:
return fname
def get_inchat_relative_files(self):
files = [self.get_rel_fname(fname) for fname in self.abs_fnames]