1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

fix tests and minor changes

- use the iterator in `CanonPath` to count `level`
- use the `CanonPath::basename` method
- use `CanonPath::root` instead of `CanonPath{""}`
- remove `Path` and `PathView`, use `std::filesystem::path` directly
This commit is contained in:
siddhantCodes 2024-07-03 17:34:02 +05:30
parent 72bb530141
commit 2cf24a2df0
7 changed files with 21 additions and 13 deletions

View file

@ -84,8 +84,12 @@ struct RestoreRegularFile : CreateRegularFileSink {
void RestoreSink::createRegularFile(const CanonPath & path, std::function<void(CreateRegularFileSink &)> func)
{
std::cout << "SCREAM!!!====== " << dstPath / path.rel() << std::endl;
std::filesystem::path p = dstPath / path.rel();
auto p = dstPath;
if (!path.rel().empty()) {
p = p / path.rel();
}
RestoreRegularFile crf;
crf.fd =
#ifdef _WIN32
@ -136,7 +140,9 @@ void RestoreRegularFile::operator () (std::string_view data)
void RestoreSink::createSymlink(const CanonPath & path, const std::string & target)
{
std::filesystem::path p = dstPath / path.rel();
auto p = dstPath;
if (!path.rel().empty())
p = dstPath / path.rel();
nix::createSymlink(target, p);
}