diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-08T09·53+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-07-08T09·53+0000 |
commit | ab644ad10b00a5fd23e8d8a705a7a8a8aaf53c57 (patch) | |
tree | a9cc1e07bbabf06d094df0e4c5c7a71008fb5b37 /src | |
parent | a5a90f501e471383a8dfccfe8af3c804cefa77cf (diff) |
* BaseName() primitive for the generation of more sensible names
(especially in fetchurl.fix).
Diffstat (limited to 'src')
-rw-r--r-- | src/fix.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fix.cc b/src/fix.cc index eb77a494229c..0797362fd0ee 100644 --- a/src/fix.cc +++ b/src/fix.cc @@ -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); } |