Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pdd/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ def preprocess(prompt: str, recursive: bool = False, double_curly_brackets: bool
return prompt

def get_file_path(file_name: str) -> str:
base_path = './'
return os.path.join(base_path, file_name)
# Directly return the file_name if base_path is './' as os.path.join('./', file_name) is equivalent to file_name with possible added './'
# We avoid an unnecessary call to os.path.join for a single directory
if not os.path.isabs(file_name):
return f'./{file_name}' if not file_name.startswith('./') else file_name
return file_name

def process_backtick_includes(text: str, recursive: bool) -> str:
# More specific pattern that doesn't match nested > characters
Expand Down