Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2862 fix determine base dir #2863

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Changes from 2 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: 4 additions & 3 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,12 +1047,13 @@ def load_tools_config(directory: Union[str, Path] = "."):

def determine_base_dir(directory="."):
base_dir = start_dir = Path(directory).absolute()
while base_dir != base_dir.parent:
# Only iterate up the tree if the start dir doesn't have a config
while not get_first_available_path(base_dir, CONFIG_PATHS) and base_dir != base_dir.parent:
base_dir = base_dir.parent
config_fn = get_first_available_path(base_dir, CONFIG_PATHS)
if config_fn:
return directory if base_dir == start_dir else base_dir
return directory
break
return directory if base_dir == start_dir else base_dir


def get_first_available_path(directory, paths):
Expand Down
Loading