1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 16:02:43 +01:00

moveFile -> renameFile

`move` tends to have this `mv` connotation of “I will copy it for you if
needs be”
This commit is contained in:
Théophane Hufschmitt 2022-04-13 14:10:36 +02:00
parent a4f0fd633c
commit d71d9e9fbf
9 changed files with 13 additions and 13 deletions

View file

@ -705,7 +705,7 @@ static void movePath(const Path & src, const Path & dst)
if (changePerm)
chmod_(src, st.st_mode | S_IWUSR);
moveFile(src, dst);
renameFile(src, dst);
if (changePerm)
chmod_(dst, st.st_mode);

View file

@ -223,7 +223,7 @@ static void movePath(const Path & src, const Path & dst)
if (changePerm)
chmod_(src, st.st_mode | S_IWUSR);
moveFile(src, dst);
renameFile(src, dst);
if (changePerm)
chmod_(dst, st.st_mode);
@ -310,7 +310,7 @@ bool LocalDerivationGoal::cleanupDecideWhetherDiskFull()
if (buildMode != bmCheck && status.known->isValid()) continue;
auto p = worker.store.printStorePath(status.known->path);
if (pathExists(chrootRootDir + p))
moveFile((chrootRootDir + p), p);
renameFile((chrootRootDir + p), p);
}
return diskFull;
@ -2624,7 +2624,7 @@ DrvOutputs LocalDerivationGoal::registerOutputs()
Path prev = path + checkSuffix;
deletePath(prev);
Path dst = path + checkSuffix;
moveFile(path, dst);
renameFile(path, dst);
}
}

View file

@ -22,7 +22,7 @@ void builtinUnpackChannel(const BasicDerivation & drv)
auto entries = readDirectory(out);
if (entries.size() != 1)
throw Error("channel tarball '%s' contains more than one file", src);
moveFile((out + "/" + entries[0].name), (out + "/" + channelName));
renameFile((out + "/" + entries[0].name), (out + "/" + channelName));
}
}

View file

@ -39,7 +39,7 @@ static void makeSymlink(const Path & link, const Path & target)
createSymlink(target, tempLink);
/* Atomically replace the old one. */
moveFile(tempLink, link);
renameFile(tempLink, link);
}

View file

@ -57,7 +57,7 @@ protected:
AutoDelete del(tmp, false);
StreamToSourceAdapter source(istream);
writeFile(tmp, source);
moveFile(tmp, path2);
renameFile(tmp, path2);
del.cancel();
}

View file

@ -1430,7 +1430,7 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
writeFile(realPath, dumpSource);
} else {
/* Move the temporary path we restored above. */
moveFile(tempPath, realPath);
renameFile(tempPath, realPath);
}
/* For computing the nar hash. In recursive SHA-256 mode, this
@ -1941,7 +1941,7 @@ void LocalStore::addBuildLog(const StorePath & drvPath, std::string_view log)
writeFile(tmpFile, compress("bzip2", log));
moveFile(tmpFile, logPath);
renameFile(tmpFile, logPath);
}
std::optional<std::string> LocalStore::getVersion()

View file

@ -230,7 +230,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
/* Atomically replace the old file with the new hard link. */
try {
moveFile(tempLink, path);
renameFile(tempLink, path);
} catch (SysError & e) {
if (unlink(tempLink.c_str()) == -1)
printError("unable to unlink '%1%'", tempLink);