boost::filesystem::rename

Morning List, looking at the documentation of
template
void rename(const Path1& from_p, const Path2& to_p); Requires: Path1::external_string_type and Path2::external_string_type are the same type.
Effects: Renames from_p to to_p, as if by POSIX rename().
Postconditions: !exists(from_p) && exists(to_p), and the contents and attributes of the file originally named from_p are otherwise unchanged.
[Note: If from_p and to_p resolve to the same file, no action is taken. Otherwise, if to_p resolves to an existing file, it is removed. A symbolic link >is itself renamed, rather than the file it resolves to being renamed. -- end note]
that does not seem to be what the code does since it checks whether to_p exists and throws an error if it does. I need an atomic overwrite to an existing file since that filename is generated by mkstemp. What will be the semantics of rename i.e. is the documentation in error or is the code (or am I missing something)? Thanks in advance, Immanuel
participants (1)
-
immanuel litzroth