-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alternative implementation for resolving the sibling
- Loading branch information
Showing
2 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/resources/io/viash/platforms/nextflow/functions/_resolveSiblingIfNotAbsolute.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Resolve a path relative to the current file. | ||
* | ||
* @param str The path to resolve, as a String. | ||
* @param parentPath The path to resolve relative to, as a Path. | ||
* | ||
* @return The path that may have been resovled, as a Path. | ||
*/ | ||
|
||
def _resolveSiblingIfNotAbsolute(str, parentPath) { | ||
if (str !instanceof String) { | ||
return str | ||
} | ||
strAsPath = file(str, hidden: true, relative: true) | ||
if (!strAsPath.isAbsolute()) { | ||
return parentPath.resolveSibling(str) | ||
} | ||
return strAsPath | ||
} |