1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 21:16:02 +01:00

Fix evalState::rootFS paths' to_string()

This showPath is getting a little too ad hoc, but it works for now.
This commit is contained in:
Robert Hensing 2024-03-25 12:43:30 +01:00 committed by Tom Bereknyei
parent 5def18e53b
commit f3d2a16eff
2 changed files with 4 additions and 1 deletions

View file

@ -315,6 +315,7 @@ EvalState::EvalState(
{ {
corepkgsFS->setPathDisplay("<nix", ">"); corepkgsFS->setPathDisplay("<nix", ">");
internalFS->setPathDisplay("«nix-internal»", ""); internalFS->setPathDisplay("«nix-internal»", "");
rootFS->setPathDisplay("/", "");
countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0"; countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0";

View file

@ -64,7 +64,9 @@ void SourceAccessor::setPathDisplay(std::string displayPrefix, std::string displ
std::string SourceAccessor::showPath(const CanonPath & path) std::string SourceAccessor::showPath(const CanonPath & path)
{ {
return displayPrefix + (displayPrefix.empty() ? "" : ":") + path.rel() + displaySuffix; return displayPrefix
+ ((displayPrefix.empty() || displayPrefix.ends_with("/")) ? "" : ":") + path.rel()
+ displaySuffix;
} }
CanonPath SourceAccessor::resolveSymlinks( CanonPath SourceAccessor::resolveSymlinks(