mirror of
https://github.com/NixOS/nix.git
synced 2025-12-22 17:01:08 +01:00
libutil: Fix canonPath, makeTempPath and createTempDir on windows
This at least makes canonPath not consider the drive letter as a path component. There still some issues with it on windows, but at least this gets us through some of the libutil-tests. Also since we don't want to change which env variables nix considers we don't use std::filesystem::temp_directory_path and implement the windows version directly.
This commit is contained in:
parent
2f092870e4
commit
675656ffba
6 changed files with 49 additions and 12 deletions
|
|
@ -115,9 +115,6 @@ Path canonPath(PathView path, bool resolveSymlinks)
|
|||
if (!isAbsolute(path))
|
||||
throw Error("not an absolute path: '%1%'", path);
|
||||
|
||||
// For Windows
|
||||
auto rootName = std::filesystem::path{path}.root_name();
|
||||
|
||||
/* This just exists because we cannot set the target of `remaining`
|
||||
(the callback parameter) directly to a newly-constructed string,
|
||||
since it is `std::string_view`. */
|
||||
|
|
@ -147,8 +144,6 @@ Path canonPath(PathView path, bool resolveSymlinks)
|
|||
}
|
||||
});
|
||||
|
||||
if (!rootName.empty())
|
||||
ret = rootName.string() + std::move(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -672,11 +667,6 @@ void AutoUnmount::cancel()
|
|||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::filesystem::path defaultTempDir()
|
||||
{
|
||||
return getEnvNonEmpty("TMPDIR").value_or("/tmp");
|
||||
}
|
||||
|
||||
std::filesystem::path createTempDir(const std::filesystem::path & tmpRoot, const std::string & prefix, mode_t mode)
|
||||
{
|
||||
while (1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue