From 1c1411b5064acaf86d3429a25d8b22e49db6e30a Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 7 Jul 2023 17:19:32 -0700 Subject: [PATCH] Adopt safe_abs_path --- aider/coders/single_wholefile_func_coder.py | 4 +--- aider/coders/wholefile_func_coder.py | 4 +--- aider/commands.py | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/aider/coders/single_wholefile_func_coder.py b/aider/coders/single_wholefile_func_coder.py index a9dd2494a..dc74b9ef0 100644 --- a/aider/coders/single_wholefile_func_coder.py +++ b/aider/coders/single_wholefile_func_coder.py @@ -1,5 +1,3 @@ -import os - from aider import diffs from ..dump import dump # noqa: F401 @@ -88,7 +86,7 @@ class SingleWholeFileFunctionCoder(Coder): lines = content.splitlines(keepends=True) # ending an existing block - full_path = os.path.abspath(os.path.join(self.root, fname)) + full_path = self.abs_root_path(fname) content = self.io.read_text(full_path) if content is None: diff --git a/aider/coders/wholefile_func_coder.py b/aider/coders/wholefile_func_coder.py index 5c7cbd6ae..94c827305 100644 --- a/aider/coders/wholefile_func_coder.py +++ b/aider/coders/wholefile_func_coder.py @@ -1,5 +1,3 @@ -import os - from aider import diffs from ..dump import dump # noqa: F401 @@ -99,7 +97,7 @@ class WholeFileFunctionCoder(Coder): lines = content.splitlines(keepends=True) # ending an existing block - full_path = os.path.abspath(os.path.join(self.root, fname)) + full_path = self.abs_root_path(fname) content = self.io.read_text(full_path) if content is None: diff --git a/aider/commands.py b/aider/commands.py index 3a70659c5..d0517d834 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1,5 +1,4 @@ import json -import os import shlex import subprocess import sys @@ -350,7 +349,7 @@ class Commands: other_files = [] chat_files = [] for file in files: - abs_file_path = os.path.abspath(os.path.join(self.coder.root, file)) + abs_file_path = self.coder.abs_root_path(file) if abs_file_path in self.coder.abs_fnames: chat_files.append(file) else: