aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/builtins
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane@hufschmitt.net>2022-03-17 15:28:46 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2022-08-03 10:27:25 +0200
commitc2de0a232c1cfddb1f1385ffd23dd43a2099458e (patch)
tree1e174413830f7951f995fcbe417bb132a2dbb081 /src/libstore/builtins
parent8119390abcbb25e849acc50d0af0b37d85adfb04 (diff)
Create a wrapper around stdlib’s `rename`
Directly takes some c++ strings, and gently throws an exception on error (rather than having to inline this logic everywhere)
Diffstat (limited to 'src/libstore/builtins')
-rw-r--r--src/libstore/builtins/unpack-channel.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstore/builtins/unpack-channel.cc b/src/libstore/builtins/unpack-channel.cc
index 426d58a53..a8417d7ff 100644
--- a/src/libstore/builtins/unpack-channel.cc
+++ b/src/libstore/builtins/unpack-channel.cc
@@ -22,8 +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);
- if (rename((out + "/" + entries[0].name).c_str(), (out + "/" + channelName).c_str()) == -1)
- throw SysError("renaming channel directory");
+ moveFile((out + "/" + entries[0].name), (out + "/" + channelName));
}
}