mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
Merge pull request #14515 from NixOS/dirOf-dont-call-std-filesystem
libexpr: Don't use nix::dirOf in prim_dirOf (fix 2.23 regression)
This commit is contained in:
commit
6ebaba50dd
3 changed files with 29 additions and 2 deletions
|
|
@ -2022,8 +2022,13 @@ static void prim_dirOf(EvalState & state, const PosIdx pos, Value ** args, Value
|
|||
NixStringContext context;
|
||||
auto path = state.coerceToString(
|
||||
pos, *args[0], context, "while evaluating the first argument passed to 'builtins.dirOf'", false, false);
|
||||
auto dir = dirOf(*path);
|
||||
v.mkString(dir, context);
|
||||
auto pos = path->rfind('/');
|
||||
if (pos == path->npos)
|
||||
v.mkStringMove(".", context);
|
||||
else if (pos == 0)
|
||||
v.mkStringMove("/", context);
|
||||
else
|
||||
v.mkString(path->substr(0, pos), context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue