diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-24 09:36:06 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-11-24 11:18:22 +0000 |
commit | 3966ab51ff140f173f1f0c23fa3a9ef985c73d27 (patch) | |
tree | f30302c2c40e8d1b30e3ab589917eca5883aa3a2 /src/corelib/io | |
parent | 0861c2176c6dc1c69b733c1a843c2db5ec8ea786 (diff) | |
parent | 4783de0473a288fdff7e5354c12315ba025ec7e0 (diff) |
Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfile_p.h | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 20 | ||||
-rw-r--r-- | src/corelib/io/qtemporaryfile_p.h | 14 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 3 |
4 files changed, 29 insertions, 10 deletions
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h index fd7db3c120..545890c6b3 100644 --- a/src/corelib/io/qfile_p.h +++ b/src/corelib/io/qfile_p.h @@ -70,7 +70,7 @@ protected: bool openExternalFile(int flags, int fd, QFile::FileHandleFlags handleFlags); bool openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handleFlags); - virtual QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; QString fileName; }; diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 5de85f9811..1b908eac55 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -65,6 +65,13 @@ #include <MobileCoreServices/MobileCoreServices.h> #endif +#if defined(Q_OS_DARWIN) +// We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but +// we need these declarations: +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +extern "C" NSString *NSTemporaryDirectory(); +#endif + QT_BEGIN_NAMESPACE #if defined(Q_OS_DARWIN) @@ -703,8 +710,17 @@ QString QFileSystemEngine::tempPath() return QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE); #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); - if (temp.isEmpty()) - temp = QLatin1String("/tmp"); + if (temp.isEmpty()) { +#if defined(Q_OS_DARWIN) && !defined(QT_BOOTSTRAPPED) + if (NSString *nsPath = NSTemporaryDirectory()) { + temp = QString::fromCFString((CFStringRef)nsPath); + } else { +#else + { +#endif + temp = QLatin1String("/tmp"); + } + } return QDir::cleanPath(temp); #endif } diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index d057603034..7f365f0e8a 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -70,7 +70,7 @@ protected: explicit QTemporaryFilePrivate(const QString &templateNameIn); ~QTemporaryFilePrivate(); - QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; void resetFileEngine() const; bool autoRemove = true; @@ -99,14 +99,14 @@ public: ~QTemporaryFileEngine(); bool isReallyOpen() const; - void setFileName(const QString &file); + void setFileName(const QString &file) override; void setFileTemplate(const QString &fileTemplate); - bool open(QIODevice::OpenMode flags); - bool remove(); - bool rename(const QString &newName); - bool renameOverwrite(const QString &newName); - bool close(); + bool open(QIODevice::OpenMode flags) override; + bool remove() override; + bool rename(const QString &newName) override; + bool renameOverwrite(const QString &newName) override; + bool close() override; quint32 fileMode; bool filePathIsTemplate; diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 5b34813a71..60ce752eb6 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3690,6 +3690,9 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) return false; + if (options & QUrl::RemovePath) + return true; + // Compare paths, after applying path-related options QString path1; d->appendPath(path1, options, QUrlPrivate::Path); |