diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a3018fe..0e198caa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ - Linting will now check if the schema is correct for the used validation plugin ([#3116])(https://github.com/nf-core/tools/pull/3116) - Linting will now check the use of the right validation plugin include statements in the workflow scripts ([#3116])(https://github.com/nf-core/tools/pull/3116) - Full linting for correct use of nf-schema and nf-validation ([#3116](https://github.com/nf-core/tools/pull/3116)) +- Handle cases where the directory path contains the name of the component ([#3147](https://github.com/nf-core/tools/pull/3147)) ### Pipeline create command diff --git a/nf_core/components/nfcore_component.py b/nf_core/components/nfcore_component.py index db3196be9..5f29bea4e 100644 --- a/nf_core/components/nfcore_component.py +++ b/nf_core/components/nfcore_component.py @@ -64,7 +64,12 @@ def __init__( self.process_name = "" self.environment_yml: Optional[Path] = Path(self.component_dir, "environment.yml") - repo_dir = self.component_dir.parts[: self.component_dir.parts.index(self.component_name.split("/")[0])][-1] + name_index = ( + len(self.component_dir.parts) + - 1 + - self.component_dir.parts[::-1].index(self.component_name.split("/")[0]) + ) + repo_dir = self.component_dir.parts[:name_index][-1] self.org = repo_dir self.nftest_testdir = Path(self.component_dir, "tests") self.nftest_main_nf = Path(self.nftest_testdir, "main.nf.test")