From ab644ad10b00a5fd23e8d8a705a7a8a8aaf53c57 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jul 2003 09:53:46 +0000 Subject: [PATCH] * BaseName() primitive for the generation of more sensible names (especially in fetchurl.fix). --- src/fix.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fix.cc b/src/fix.cc index eb77a4942..0797362fd 100644 --- a/src/fix.cc +++ b/src/fix.cc @@ -208,6 +208,14 @@ static Expr evalExpr(Expr e) return ATmake("Include()", ((string) eHash).c_str()); } + /* BaseName primitive function. */ + if (ATmatch(e, "BaseName()", &e1)) { + e1 = evalExpr(e1); + if (!ATmatch(e1, "", &s1)) + throw badTerm("string expected", e1); + return ATmake("", baseNameOf(s1).c_str()); + } + /* Barf. */ throw badTerm("invalid expression", e); }