feat: add touch_file function to handle file creation

This commit is contained in:
Paul Gauthier (aider) 2024-08-31 08:08:10 -07:00
parent 441c07586d
commit 0f1b15942d

View file

@ -291,6 +291,15 @@ def format_tokens(count):
return f"{round(count / 1000)}k" return f"{round(count / 1000)}k"
def touch_file(fname):
try:
fname.parent.mkdir(parents=True, exist_ok=True)
fname.touch()
return True
except OSError:
return False
def check_pip_install_extra(io, module, prompt, pip_install_cmd): def check_pip_install_extra(io, module, prompt, pip_install_cmd):
if module: if module:
try: try: