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:
@@ -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); };
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user