mirror of
https://github.com/NixOS/nix.git
synced 2025-12-20 16:01:07 +01:00
commit
5b95745bc9
16 changed files with 32 additions and 30 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue