1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

nix flake: clarify error message when file is an unknown type

This commit is contained in:
Tristan Ross 2025-01-09 12:50:05 -08:00
parent 2d9b213cc2
commit 22adffec34
No known key found for this signature in database
GPG key ID: B09C422035669AF8
7 changed files with 59 additions and 13 deletions

View file

@ -5,6 +5,26 @@ namespace nix {
static std::atomic<size_t> nextNumber{0};
bool SourceAccessor::Stat::isNotNARSerialisable()
{
return this->type != tRegular && this->type != tSymlink && this->type != tDirectory;
}
std::string SourceAccessor::Stat::typeString() {
switch (this->type) {
case tRegular: return "regular";
case tSymlink: return "symlink";
case tDirectory: return "directory";
case tChar: return "character device";
case tBlock: return "block device";
case tSocket: return "socket";
case tFifo: return "fifo";
case tUnknown:
default: return "unknown";
}
return "unknown";
}
SourceAccessor::SourceAccessor()
: number(++nextNumber)
, displayPrefix{"«unknown»"}