From f695e71398e4786f5eca4b57e4b9ce4f9455a8ce Mon Sep 17 00:00:00 2001 From: contributor Date: Wed, 25 Jun 2025 13:34:14 +0300 Subject: [PATCH] feat: better place to create history file dirs (InputOutput ctr) this decreases number of IO operations --- aider/io.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/io.py b/aider/io.py index f0000e965..46621cfce 100644 --- a/aider/io.py +++ b/aider/io.py @@ -308,9 +308,11 @@ class InputOutput: self.yes = yes self.input_history_file = input_history_file + Path(self.input_history_file).parent.mkdir(parents=True, exist_ok=True) self.llm_history_file = llm_history_file if chat_history_file is not None: self.chat_history_file = Path(chat_history_file) + self.chat_history_file.parent.mkdir(parents=True, exist_ok=True) else: self.chat_history_file = None @@ -731,7 +733,6 @@ class InputOutput: if not self.input_history_file: return try: - Path(self.input_history_file).parent.mkdir(parents=True, exist_ok=True) FileHistory(self.input_history_file).append_string(inp) # Also add to the in-memory history if it exists if self.prompt_session and self.prompt_session.history: @@ -1117,7 +1118,6 @@ class InputOutput: text += "\n" if self.chat_history_file is not None: try: - self.chat_history_file.parent.mkdir(parents=True, exist_ok=True) with self.chat_history_file.open("a", encoding=self.encoding, errors="ignore") as f: f.write(text) except (PermissionError, OSError) as err: