* BaseName() primitive for the generation of more sensible names
(especially in fetchurl.fix).
This commit is contained in:
parent
a5a90f501e
commit
ab644ad10b
|
@ -208,6 +208,14 @@ static Expr evalExpr(Expr e)
|
|||
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. */
|
||||
throw badTerm("invalid expression", e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue