refactor: Move find_common_root into aider/utils.py and update Coder class to use it

This commit is contained in:
Paul Gauthier (aider) 2024-08-22 13:55:32 -07:00
parent 8c886d7dd3
commit 221cde0fed
2 changed files with 11 additions and 7 deletions

View file

@ -272,6 +272,16 @@ class Spinner:
print("\r" + " " * (len(self.text) + 3))
import os
def find_common_root(abs_fnames):
if len(abs_fnames) == 1:
return os.path.dirname(list(abs_fnames)[0])
elif abs_fnames:
return os.path.commonpath(list(abs_fnames))
else:
return os.getcwd()
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
try:
__import__(module)