Skip to content

Commit

Permalink
WIP fix baseNameOf (needs test maybe)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth authored and tomberek committed Aug 24, 2024
1 parent f13dc79 commit 52c0ef2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libexpr/primops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,10 @@ static std::string_view legacyBaseNameOf(std::string_view path)
static void prim_baseNameOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
{
NixStringContext context;
v.mkString(legacyBaseNameOf(*state.coerceToString(pos, *args[0], context,
if (v.type() == nPath)
v.mkString(baseNameOf(v.path().path.abs()), context);
else
v.mkString(legacyBaseNameOf(*state.coerceToString(pos, *args[0], context,
"while evaluating the first argument passed to builtins.baseNameOf",
false, false)), context);
}
Expand Down

0 comments on commit 52c0ef2

Please sign in to comment.