Handle missing filenames by scanning for mentions in the text

This commit is contained in:
Paul Gauthier 2023-06-24 15:32:35 -07:00
parent f2a03e917d
commit ac560c2877
3 changed files with 61 additions and 7 deletions

View file

@ -167,9 +167,10 @@ class Coder:
self.io.tool_output(f"Added {fname} to the chat.")
def find_common_root(self):
if self.abs_fnames:
common_prefix = os.path.commonpath(list(self.abs_fnames))
self.root = os.path.dirname(common_prefix)
if len(self.abs_fnames) == 1:
self.root = os.path.dirname(list(self.abs_fnames)[0])
elif self.abs_fnames:
self.root = os.path.commonpath(list(self.abs_fnames))
else:
self.root = os.getcwd()