forked from mirrors/nixpkgs
Adding a function capable of extracting the name with version out of url/file path
This commit is contained in:
parent
14b1ed53a0
commit
de5be50b2d
|
@ -155,4 +155,14 @@ rec {
|
|||
# Return true iff string v1 denotes a version older than v2.
|
||||
versionOlder = v1: v2: builtins.compareVersions v2 v1 == 1;
|
||||
|
||||
# Extract name with version from URL. Ask for separator which is
|
||||
# supposed to start extension
|
||||
nameFromURL = url: sep: let
|
||||
components = splitString "/" url;
|
||||
filename = lib.last components;
|
||||
name = builtins.head (splitString sep filename);
|
||||
in
|
||||
assert ! eqStrings name filename;
|
||||
name;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue