-
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.
implement function using regex instead of nxf code
- Loading branch information
Showing
2 changed files
with
21 additions
and
6 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
16 changes: 16 additions & 0 deletions
16
src/main/resources/io/viash/platforms/nextflow/functions/_stringIsAbsolutePath.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,16 @@ | ||
/** | ||
* Check whether a path as a string is absolute. | ||
* | ||
* In the past, we tried using `file(., relative: true).isAbsolute()`, | ||
* but the 'relative' option was added in 22.10.0. | ||
* | ||
* @param path The path to check, as a String. | ||
* | ||
* @return Whether the path is absolute, as a boolean. | ||
*/ | ||
def _stringIsAbsolutePath(path) { | ||
_resolve_URL_PROTOCOL = ~/^([a-zA-Z][a-zA-Z0-9]*:)?\\/.+/ | ||
|
||
assert path instanceof String | ||
return (path =~ _resolve_URL_PROTOCOL).size() > 0 | ||
} |