}
/*!
- \fn static QString QFile::readLink(const QString &fileName)
\since 4.2
Returns the absolute path of the file or directory referred to by the
*/
QString QFile::readLink(const QString &fileName)
{
+ // ###: static QFileSystemEngine method for this
return QFileInfo(fileName).readLink();
}
*/
bool QFile::remove(const QString &fileName)
{
- return QFile(fileName).remove();
+ int error = 0;
+ return QFileSystemEngine::removeFile(QFileSystemEntry(fileName), &error);
}
/*!
return false;
}
#ifndef QT_HAVE_RENAMEAT2
- if (QFile(newName).exists()) {
+ if (QFile::exists(newName)) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old);
*/
bool QFile::rename(const QString &oldName, const QString &newName)
{
- return QFile(oldName).rename(newName);
+#ifndef QT_HAVE_RENAMEAT2
+ if (QFile::exists(newName)) {
+ return false;
+ }
+#endif
+ int error = 0;
+ return QFileSystemEngine::renameFile(QFileSystemEntry(oldName), QFileSystemEntry(newName), &error);
}
/*!
*/
bool QFile::link(const QString &fileName, const QString &linkName)
{
- return QFile(fileName).link(linkName);
+ int error = 0;
+ return QFileSystemEngine::createLink(QFileSystemEntry(fileName), QFileSystemEntry(linkName), &error);
}
/*!
*/
bool QFile::copy(const QString &fileName, const QString &newName)
{
- return QFile(fileName).copy(newName);
+ int error = 0;
+ return QFileSystemEngine::copyFile(QFileSystemEntry(fileName), QFileSystemEntry(newName), &error);
}
/*!
/*!
- Returns the file handle of the file.
+ Returns the file handle of the file.
- This is a small positive integer, suitable for use with C library
- functions such as fdopen() and fcntl(). On systems that use file
- descriptors for sockets (i.e. Unix systems, but not Windows) the handle
- can be used with QSocketNotifier as well.
+ This is a small positive integer, suitable for use with C library
+ functions such as fdopen() and fcntl(). On systems that use file
+ descriptors for sockets (i.e. Unix systems, but not Windows) the handle
+ can be used with QSocketNotifier as well.
- If the file is not open, or there is an error, handle() returns -1.
+ If the file is not open, or there is an error, handle() returns -1.
- \sa QSocketNotifier
+ \sa QSocketNotifier
*/
int QFile::handle() const
{
Q_D(const QFile);
- if (!isOpen())
+ if (!isOpen()) {
return -1;
+ }
return d->fd;
}
*/
bool QFile::resize(const QString &fileName, qint64 sz)
{
+ // ###: static QFileSystemEngine method for this
return QFile(fileName).resize(sz);
}
*/
QFile::Permissions QFile::permissions(const QString &fileName)
{
+ // ###: static QFileSystemEngine method for this
return QFile(fileName).permissions();
}
{
Q_D(QFile);
int error = 0;
- if (!QFileSystemEngine::setPermissions(d->fileEntry, QFile::Permissions(permissions), &error)) {
+ if (!QFileSystemEngine::setPermissions(d->fileEntry, permissions, &error)) {
d->setError(QFile::PermissionsError, qt_error_string(error));
return false;
}
*/
bool QFile::setPermissions(const QString &fileName, Permissions permissions)
{
- return QFile(fileName).setPermissions(permissions);
+ int error = 0;
+ return QFileSystemEngine::setPermissions(QFileSystemEntry(fileName), permissions, &error);
}
/*!