-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make rootFS's showPath() render the paths from the original accessors
This makes paths in error messages behave similar to lazy-trees, e.g. instead of store paths like error: attribute 'foobar' missing at /nix/store/ddzfiipzqlrh3gnprmqbadnsnrxsmc9i-source/machine/configuration.nix:209:7: 208| 209| pkgs.foobar | ^ 210| ]; you now get error: attribute 'foobar' missing at /home/eelco/Misc/eelco-configurations/machine/configuration.nix:209:7: 208| 209| pkgs.foobar | ^ 210| ];
- Loading branch information
Showing
10 changed files
with
123 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
|
||
#include "source-accessor.hh" | ||
|
||
namespace nix { | ||
|
||
/** | ||
* A source accessor that just forwards every operation to another | ||
* accessor. This is not useful in itself but can be used as a | ||
* superclass for accessors that do change some operations. | ||
*/ | ||
struct ForwardingSourceAccessor : SourceAccessor | ||
{ | ||
ref<SourceAccessor> next; | ||
|
||
ForwardingSourceAccessor(ref<SourceAccessor> next) | ||
: next(next) | ||
{ | ||
} | ||
|
||
std::string readFile(const CanonPath & path) override | ||
{ | ||
return next->readFile(path); | ||
} | ||
|
||
void readFile(const CanonPath & path, Sink & sink, std::function<void(uint64_t)> sizeCallback) override | ||
{ | ||
next->readFile(path, sink, sizeCallback); | ||
} | ||
|
||
std::optional<Stat> maybeLstat(const CanonPath & path) override | ||
{ | ||
return next->maybeLstat(path); | ||
} | ||
|
||
DirEntries readDirectory(const CanonPath & path) override | ||
{ | ||
return next->readDirectory(path); | ||
} | ||
|
||
std::string readLink(const CanonPath & path) override | ||
{ | ||
return next->readLink(path); | ||
} | ||
|
||
std::string showPath(const CanonPath & path) override | ||
{ | ||
return next->showPath(path); | ||
} | ||
|
||
std::optional<std::filesystem::path> getPhysicalPath(const CanonPath & path) override | ||
{ | ||
return next->getPhysicalPath(path); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters