More std::filesystem::path for nix {cat,ls}

Also fixes a double quoting issue I accidentally introduced ccdd1f1c65
in seekableGetNarBytes.
This commit is contained in:
Sergei Zimmerman
2026-01-10 21:48:43 +03:00
parent 2ae4121c1d
commit f8a92564f7
3 changed files with 7 additions and 7 deletions

View File

@@ -268,7 +268,7 @@ GetNarBytes seekableGetNarBytes(const std::filesystem::path & path)
{
AutoCloseFD fd = openFileReadonly(path);
if (!fd)
throw NativeSysError("opening NAR cache file '%s'", path);
throw NativeSysError("opening NAR cache file %s", path);
return [inner = seekableGetNarBytes(fd.get()), fd = make_ref<AutoCloseFD>(std::move(fd))](
uint64_t offset, uint64_t length) { return inner(offset, length); };

View File

@@ -52,7 +52,7 @@ struct CmdCatStore : StoreCommand, MixCat
struct CmdCatNar : StoreCommand, MixCat
{
Path narPath;
std::filesystem::path narPath;
std::string path;
@@ -76,9 +76,9 @@ struct CmdCatNar : StoreCommand, MixCat
void run(ref<Store> store) override
{
AutoCloseFD fd = toDescriptor(open(narPath.c_str(), O_RDONLY));
AutoCloseFD fd = openFileReadonly(narPath);
if (!fd)
throw SysError("opening NAR file '%s'", narPath);
throw NativeSysError("opening NAR file %s", narPath);
auto source = FdSource{fd.get()};
struct CatRegularFileSink : NullFileSystemObjectSink

View File

@@ -126,7 +126,7 @@ struct CmdLsStore : StoreCommand, MixLs
struct CmdLsNar : Command, MixLs
{
Path narPath;
std::filesystem::path narPath;
std::string path;
@@ -150,9 +150,9 @@ struct CmdLsNar : Command, MixLs
void run() override
{
AutoCloseFD fd = toDescriptor(open(narPath.c_str(), O_RDONLY));
AutoCloseFD fd = openFileReadonly(narPath);
if (!fd)
throw SysError("opening NAR file '%s'", narPath);
throw NativeSysError("opening NAR file %s", narPath);
auto source = FdSource{fd.get()};
list(makeLazyNarAccessor(source, seekableGetNarBytes(fd.get())), CanonPath{path});
}