mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +02:00
* BaseName() primitive for the generation of more sensible names
(especially in fetchurl.fix).
This commit is contained in:
parent
a5a90f501e
commit
ab644ad10b
1 changed files with 8 additions and 0 deletions
|
@ -208,6 +208,14 @@ static Expr evalExpr(Expr e)
|
||||||
return ATmake("Include(<str>)", ((string) eHash).c_str());
|
return ATmake("Include(<str>)", ((string) eHash).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BaseName primitive function. */
|
||||||
|
if (ATmatch(e, "BaseName(<term>)", &e1)) {
|
||||||
|
e1 = evalExpr(e1);
|
||||||
|
if (!ATmatch(e1, "<str>", &s1))
|
||||||
|
throw badTerm("string expected", e1);
|
||||||
|
return ATmake("<str>", baseNameOf(s1).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
/* Barf. */
|
/* Barf. */
|
||||||
throw badTerm("invalid expression", e);
|
throw badTerm("invalid expression", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue