Skip to content

Commit

Permalink
Merge pull request #2863 from awgymer/2862-fix-determine-base-dir
Browse files Browse the repository at this point in the history
2862 fix determine base dir
  • Loading branch information
awgymer authored Mar 19, 2024
2 parents b9699d2 + 68ab4fe commit 2208791
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Update python:3.11-slim Docker digest to a2eb07f ([#2847](https://github.com/nf-core/tools/pull/2847))
- Strip out mention of "Nextflow Tower" and replace with "Seqera Platform" wherever possible
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.3.3 ([#2850](https://github.com/nf-core/tools/pull/2850))
- Fix issue with config resolution that was causing nested configs to behave unexpectedly ([#2862](https://github.com/nf-core/tools/pull/2862))

## [v2.13.1 - Tin Puppy Patch](https://github.com/nf-core/tools/releases/tag/2.13) - [2024-02-29]

Expand Down
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

0 comments on commit 2208791

Please sign in to comment.