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:
parent
314b20e813
commit
2e7b4bf673
@ -1741,11 +1741,16 @@ bool QDir::remove(const QString &fileName)
|
|||||||
true if successful; otherwise returns false.
|
true if successful; otherwise returns false.
|
||||||
|
|
||||||
On most file systems, rename() fails only if \a oldName does not
|
On most file systems, rename() fails only if \a oldName does not
|
||||||
exist, if \a newName and \a oldName are not on the same
|
exist, or if a file with the new name already exists.
|
||||||
partition or if a file with the new name already exists.
|
|
||||||
However, there are also other reasons why rename() can
|
However, there are also other reasons why rename() can
|
||||||
fail. For example, on at least one file system rename() fails if
|
fail. For example, on at least one file system rename() fails if
|
||||||
\a newName points to an open file.
|
\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)
|
bool QDir::rename(const QString &oldName, const QString &newName)
|
||||||
{
|
{
|
||||||
|
@ -698,6 +698,11 @@ QFile::remove(const QString &fileName)
|
|||||||
|
|
||||||
The file is closed before it is renamed.
|
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()
|
\sa setFileName()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user