From 0f1b15942dc21fb8964bf3b21fd6f25363b33d4d Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sat, 31 Aug 2024 08:08:10 -0700 Subject: [PATCH] feat: add touch_file function to handle file creation --- aider/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aider/utils.py b/aider/utils.py index 27cc6953d..1f3eb0455 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -291,6 +291,15 @@ def format_tokens(count): 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): if module: try: