Skip to content

Commit

Permalink
Refactor get_project_dir()
Browse files Browse the repository at this point in the history
  • Loading branch information
Siecje committed Feb 3, 2024
1 parent 79c11f3 commit 560a11d
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions htmd/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,15 @@
def get_project_dir() -> Path:
current_directory = Path.cwd()

while True:
file_path = current_directory / 'config.toml'

if file_path.is_file():
return current_directory

# Move to the parent directory
while not (current_directory / 'config.toml').is_file():
parent_directory = current_directory.parent

# If the current and parent directories are the same, break the loop
if current_directory == parent_directory:
break
return Path.cwd()

current_directory = parent_directory

return Path.cwd()
return current_directory


project_dir = get_project_dir()
Expand Down

0 comments on commit 560a11d

Please sign in to comment.