mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +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:
parent
bbeddf0602
commit
cc68ed8ff7
2 changed files with 4 additions and 3 deletions
|
@ -164,7 +164,7 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
||||||
return res.finish();
|
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)) {
|
if (EvalSettings::isPseudoUrl(s)) {
|
||||||
auto storePath = fetchers::downloadTarball(
|
auto storePath = fetchers::downloadTarball(
|
||||||
|
@ -185,7 +185,7 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s)
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return state.rootPath(CanonPath::fromCwd(s));
|
return state.rootPath(CanonPath(s, baseDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
///@file
|
///@file
|
||||||
|
|
||||||
#include "args.hh"
|
#include "args.hh"
|
||||||
|
#include "canon-path.hh"
|
||||||
#include "common-args.hh"
|
#include "common-args.hh"
|
||||||
#include "search-path.hh"
|
#include "search-path.hh"
|
||||||
|
|
||||||
|
@ -28,6 +29,6 @@ private:
|
||||||
std::map<std::string, std::string> autoArgs;
|
std::map<std::string, std::string> autoArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
SourcePath lookupFileArg(EvalState & state, std::string_view s);
|
SourcePath lookupFileArg(EvalState & state, std::string_view s, CanonPath baseDir = CanonPath::fromCwd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue