mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 05:00:58 +01:00
WIP fix baseNameOf (needs test maybe)
https://github.com/NixOS/nix/pull/10252#issuecomment-2275035429
This commit is contained in:
parent
f13dc79904
commit
52c0ef24c5
1 changed files with 4 additions and 1 deletions
|
|
@ -1705,6 +1705,9 @@ static std::string_view legacyBaseNameOf(std::string_view path)
|
||||||
static void prim_baseNameOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
static void prim_baseNameOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
NixStringContext context;
|
NixStringContext context;
|
||||||
|
if (v.type() == nPath)
|
||||||
|
v.mkString(baseNameOf(v.path().path.abs()), context);
|
||||||
|
else
|
||||||
v.mkString(legacyBaseNameOf(*state.coerceToString(pos, *args[0], context,
|
v.mkString(legacyBaseNameOf(*state.coerceToString(pos, *args[0], context,
|
||||||
"while evaluating the first argument passed to builtins.baseNameOf",
|
"while evaluating the first argument passed to builtins.baseNameOf",
|
||||||
false, false)), context);
|
false, false)), context);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue