1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Remove some unnecessary quotes around std::filesystem::path

This commit is contained in:
Eelco Dolstra 2025-01-16 17:06:59 +01:00
parent 043df13f72
commit 2ca0c62a8d

View file

@ -643,7 +643,7 @@ void setWriteTime(
// doesn't support access time just modification time. // doesn't support access time just modification time.
// //
// System clock vs File clock issues also make that annoying. // System clock vs File clock issues also make that annoying.
warn("Changing file times is not yet implemented on Windows, path is '%s'", path); warn("Changing file times is not yet implemented on Windows, path is %s", path);
#elif HAVE_UTIMENSAT && HAVE_DECL_AT_SYMLINK_NOFOLLOW #elif HAVE_UTIMENSAT && HAVE_DECL_AT_SYMLINK_NOFOLLOW
struct timespec times[2] = { struct timespec times[2] = {
{ {
@ -656,7 +656,7 @@ void setWriteTime(
}, },
}; };
if (utimensat(AT_FDCWD, path.c_str(), times, AT_SYMLINK_NOFOLLOW) == -1) if (utimensat(AT_FDCWD, path.c_str(), times, AT_SYMLINK_NOFOLLOW) == -1)
throw SysError("changing modification time of '%s' (using `utimensat`)", path); throw SysError("changing modification time of %s (using `utimensat`)", path);
#else #else
struct timeval times[2] = { struct timeval times[2] = {
{ {
@ -670,7 +670,7 @@ void setWriteTime(
}; };
#if HAVE_LUTIMES #if HAVE_LUTIMES
if (lutimes(path.c_str(), times) == -1) if (lutimes(path.c_str(), times) == -1)
throw SysError("changing modification time of '%s'", path); throw SysError("changing modification time of %s", path);
#else #else
bool isSymlink = optIsSymlink bool isSymlink = optIsSymlink
? *optIsSymlink ? *optIsSymlink
@ -678,9 +678,9 @@ void setWriteTime(
if (!isSymlink) { if (!isSymlink) {
if (utimes(path.c_str(), times) == -1) if (utimes(path.c_str(), times) == -1)
throw SysError("changing modification time of '%s' (not a symlink)", path); throw SysError("changing modification time of %s (not a symlink)", path);
} else { } else {
throw Error("Cannot modification time of symlink '%s'", path); throw Error("Cannot modification time of symlink %s", path);
} }
#endif #endif
#endif #endif
@ -709,7 +709,7 @@ void copyFile(const fs::path & from, const fs::path & to, bool andDelete)
copyFile(entry, to / entry.path().filename(), andDelete); copyFile(entry, to / entry.path().filename(), andDelete);
} }
} else { } else {
throw Error("file '%s' has an unsupported type", from); throw Error("file %s has an unsupported type", from);
} }
setWriteTime(to, lstat(from.string().c_str())); setWriteTime(to, lstat(from.string().c_str()));
@ -736,7 +736,7 @@ void moveFile(const Path & oldName, const Path & newName)
auto tempCopyTarget = temp / "copy-target"; auto tempCopyTarget = temp / "copy-target";
if (e.code().value() == EXDEV) { if (e.code().value() == EXDEV) {
fs::remove(newPath); fs::remove(newPath);
warn("Cant rename %s as %s, copying instead", oldName, newName); warn("cant rename %s as %s, copying instead", oldName, newName);
copyFile(oldPath, tempCopyTarget, true); copyFile(oldPath, tempCopyTarget, true);
std::filesystem::rename( std::filesystem::rename(
os_string_to_string(PathViewNG { tempCopyTarget }), os_string_to_string(PathViewNG { tempCopyTarget }),