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)
This commit is contained in:
committed by
Théophane Hufschmitt
parent
8119390abc
commit
c2de0a232c
@@ -57,8 +57,7 @@ protected:
|
||||
AutoDelete del(tmp, false);
|
||||
StreamToSourceAdapter source(istream);
|
||||
writeFile(tmp, source);
|
||||
if (rename(tmp.c_str(), path2.c_str()))
|
||||
throw SysError("renaming '%1%' to '%2%'", tmp, path2);
|
||||
moveFile(tmp, path2);
|
||||
del.cancel();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user