Document QFile::rename and QDir::rename's copy operation

Change-Id: Ie81804f77510cfb73917332c8faaf921525fc26e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Vincent A 2012-03-27 23:02:22 +02:00 committed by Qt by Nokia
parent 314b20e813
commit 2e7b4bf673
2 changed files with 12 additions and 2 deletions

View File

@ -1741,11 +1741,16 @@ bool QDir::remove(const QString &fileName)
true if successful; otherwise returns false.
On most file systems, rename() fails only if \a oldName does not
exist, if \a newName and \a oldName are not on the same
partition or if a file with the new name already exists.
exist, or if a file with the new name already exists.
However, there are also other reasons why rename() can
fail. For example, on at least one file system rename() fails if
\a newName points to an open file.
If \a oldName is a file (not a directory) that can't be renamed
right away, Qt will try to copy \a oldName to \a newName and remove
\a oldName.
\sa QFile::rename()
*/
bool QDir::rename(const QString &oldName, const QString &newName)
{

View File

@ -698,6 +698,11 @@ QFile::remove(const QString &fileName)
The file is closed before it is renamed.
If the rename operation fails, Qt will attempt to copy this file's
contents to \a newName, and then remove this file, keeping only
\a newName. If that copy operation fails or this file can't be removed,
the destination file \a newName is removed to restore the old state.
\sa setFileName()
*/