1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

libcmd: lookupFileArg(): add baseDir

This will allow a different base directory to be used, matching
a shebang script location instead of the working directory.
This commit is contained in:
Robert Hensing 2023-05-12 19:42:49 +02:00 committed by tomberek
parent bbeddf0602
commit cc68ed8ff7
2 changed files with 4 additions and 3 deletions

View file

@ -164,7 +164,7 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
return res.finish();
}
SourcePath lookupFileArg(EvalState & state, std::string_view s)
SourcePath lookupFileArg(EvalState & state, std::string_view s, CanonPath baseDir)
{
if (EvalSettings::isPseudoUrl(s)) {
auto storePath = fetchers::downloadTarball(
@ -185,7 +185,7 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s)
}
else
return state.rootPath(CanonPath::fromCwd(s));
return state.rootPath(CanonPath(s, baseDir));
}
}