1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-20 16:01:07 +01:00

Merge pull request #14702 from NixOS/fix-mingw

Fix mingw build
This commit is contained in:
Eelco Dolstra 2025-12-03 19:55:03 +00:00 committed by GitHub
commit 5b95745bc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 32 additions and 30 deletions

View file

@ -687,7 +687,7 @@ std::filesystem::path createTempDir(const std::filesystem::path & tmpRoot, const
checkInterrupt();
std::filesystem::path tmpDir = makeTempPath(tmpRoot, prefix);
if (mkdir(
tmpDir.c_str()
tmpDir.string().c_str()
#ifndef _WIN32 // TODO abstract mkdir perms for Windows
,
mode
@ -734,7 +734,7 @@ AutoCloseFD createAnonymousTempFile()
std::pair<AutoCloseFD, Path> createTempFile(const Path & prefix)
{
Path tmpl(defaultTempDir() + "/" + prefix + ".XXXXXX");
Path tmpl(defaultTempDir().string() + "/" + prefix + ".XXXXXX");
// Strictly speaking, this is UB, but who cares...
// FIXME: use O_TMPFILE.
// FIXME: Windows should use FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE

View file

@ -206,8 +206,9 @@ void FdSource::restart()
if (!isSeekable)
throw Error("can't seek to the start of a file");
buffer.reset();
read = bufPosOut = bufPosOut = 0;
if (lseek(fd, 0, SEEK_SET) == -1)
read = bufPosIn = bufPosOut = 0;
int fd_ = fromDescriptorReadOnly(fd);
if (lseek(fd_, 0, SEEK_SET) == -1)
throw SysError("seeking to the start of a file");
}

View file

@ -90,7 +90,7 @@ std::string expandTilde(std::string_view path)
// TODO: expand ~user ?
auto tilde = path.substr(0, 2);
if (tilde == "~/" || tilde == "~")
return getHome() + std::string(path.substr(1));
return getHome().string() + std::string(path.substr(1));
else
return std::string(path);
}

View file

@ -40,7 +40,7 @@ std::filesystem::path getHome()
static std::filesystem::path homeDir = []() {
std::filesystem::path homeDir = getEnv("USERPROFILE").value_or("C:\\Users\\Default");
assert(!homeDir.empty());
return canonPath(homeDir);
return canonPath(homeDir.string());
}();
return homeDir;
}