1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Use std::filesystem::path in more places (#10657)

Progress on #9205

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>

* Get rid of `PathNG`, just use `std::filesystem::path`
This commit is contained in:
Siddhant Kumar 2024-05-08 03:58:50 +05:30 committed by GitHub
parent 9ae6455b0e
commit fcbc36cf78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 104 additions and 82 deletions

View file

@ -171,7 +171,7 @@ static void main_nix_build(int argc, char * * argv)
; // obsolete
else if (*arg == "--no-out-link" || *arg == "--no-link")
outLink = (Path) tmpDir + "/result";
outLink = (tmpDir.path() / "result").string();
else if (*arg == "--attr" || *arg == "-A")
attrPaths.push_back(getArg(*arg, arg, end));
@ -504,7 +504,7 @@ static void main_nix_build(int argc, char * * argv)
if (passAsFile.count(var.first)) {
keepTmp = true;
auto fn = ".attr-" + std::to_string(fileNr++);
Path p = (Path) tmpDir + "/" + fn;
Path p = (tmpDir.path() / fn).string();
writeFile(p, var.second);
env[var.first + "Path"] = p;
} else
@ -536,10 +536,10 @@ static void main_nix_build(int argc, char * * argv)
auto json = structAttrs.value();
structuredAttrsRC = writeStructuredAttrsShell(json);
auto attrsJSON = (Path) tmpDir + "/.attrs.json";
auto attrsJSON = (tmpDir.path() / ".attrs.json").string();
writeFile(attrsJSON, json.dump());
auto attrsSH = (Path) tmpDir + "/.attrs.sh";
auto attrsSH = (tmpDir.path() / ".attrs.sh").string();
writeFile(attrsSH, structuredAttrsRC);
env["NIX_ATTRS_SH_FILE"] = attrsSH;
@ -552,7 +552,7 @@ static void main_nix_build(int argc, char * * argv)
convenience, source $stdenv/setup to setup additional
environment variables and shell functions. Also don't
lose the current $PATH directories. */
auto rcfile = (Path) tmpDir + "/rc";
auto rcfile = (tmpDir.path() / "rc").string();
std::string rc = fmt(
R"(_nix_shell_clean_tmpdir() { command rm -rf %1%; }; )"s +
(keepTmp ?
@ -583,7 +583,7 @@ static void main_nix_build(int argc, char * * argv)
"unset TZ; %6%"
"shopt -s execfail;"
"%7%",
shellEscape(tmpDir),
shellEscape(tmpDir.path().string()),
(pure ? "" : "p=$PATH; "),
(pure ? "" : "PATH=$PATH:$p; unset p; "),
shellEscape(dirOf(*shell)),