remove redundant file existence check in QDir::rename()

if the source does not exists renaming will fail anyway, also the check is
subject to race-condition

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-06 09:01:40 +03:00
parent 14dedd9435
commit cf16699d42
2 changed files with 5 additions and 32 deletions

View file

@ -3,7 +3,7 @@
# https://wiki.archlinux.org/index.php/Arch_package_guidelines
pkgname=katie-git
pkgver=4.13.0.r7943.1ffa66d5c
pkgver=4.13.0.r8005.14dedd943
pkgrel=1
pkgdesc='C++ toolkit derived from the Qt 4.8 framework'
arch=('i486' 'i686' 'pentium4' 'x86_64' 'arm')

View file

@ -1376,10 +1376,7 @@ bool QDir::rename(const QString &oldName, const QString &newName)
return false;
}
QFile file(filePath(oldName));
if (!file.exists())
return false;
return file.rename(filePath(newName));
return QFile::rename(filePath(oldName), filePath(newName));
}
/*!
@ -1472,34 +1469,11 @@ QString QDir::currentPath()
/*!
Returns the absolute path of the user's home directory.
Under Windows this function will return the directory of the
current user's profile. Typically, this is:
\snippet doc/src/snippets/code/src_corelib_io_qdir.cpp 12
Use the toNativeSeparators() function to convert the separators to
the ones that are appropriate for the underlying operating system.
If the directory of the current user's profile does not exist or
cannot be retrieved, the following alternatives will be checked (in
the given order) until an existing and available path is found:
\list 1
\o The path specified by the \c USERPROFILE environment variable.
\o The path formed by concatenating the \c HOMEDRIVE and \c HOMEPATH
environment variables.
\o The path specified by the \c HOME environment variable.
\o The path returned by the rootPath() function (which uses the \c SystemDrive
environment variable)
\o The \c{C:/} directory.
\endlist
Under non-Windows operating systems the \c HOME environment
variable is used if it exists, otherwise the path returned by the
rootPath().
On Symbian this typically returns "c:/data",
i.e. the same as native PathInfo::PhoneMemoryRootPath().
For Unix operating systems the \c HOME environment variable is used
if it exists, otherwise the path returned by the rootPath().
\sa home(), currentPath(), rootPath(), tempPath()
*/
@ -1563,8 +1537,7 @@ QString QDir::tempPath()
/*!
Returns the absolute path of the root directory.
For Unix operating systems this returns "/". For Windows and Symbian file
systems this normally returns "c:/". I.E. the root of the system drive.
For Unix operating systems this returns "/".
\sa root(), currentPath(), homePath(), tempPath()
*/