diff options
author | Murray Read <ext-murray.2.read@nokia.com> | 2012-02-13 16:33:22 +0000 |
---|---|---|
committer | Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com> | 2012-02-15 09:46:45 +0100 |
commit | 6e7930aa3ea2d9207ba22b8ef44786668eaa45f7 (patch) | |
tree | a7e9462d1bc5f7e2de2b9676391d98c0dcffcda4 /src/corelib/io/qfilesystemengine_symbian.cpp | |
parent | 8cb8c42245581d90fcff23912f5d72857b40b8e8 (diff) | |
download | qt4-tools-6e7930aa3ea2d9207ba22b8ef44786668eaa45f7.tar.gz |
Checking for directory exists in failed QDir::mkpath on Symbian
QDir::mkpath should return true if the directory already exists. In the
new native Symbian implementation, RFs returns KErrPermission denied
when you try to access some data caged directories such as C:\private.
This was being interpreted as failure, as the code expected
KErrAlreadyExists for the case where the directory exists.
In this circumstance we now check if the directory already exists.
Task-number: ou1cimx1#974477
Change-Id: Ie476219bc963c23d3c7e1773ebded8ecf137fd3c
Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
(cherry picked from commit cdd09cc4ebab4e95f7c1286f09cef17a2c9cedf4)
Diffstat (limited to 'src/corelib/io/qfilesystemengine_symbian.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemengine_symbian.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp index c8c1dfdc84..d3e8f4d4fd 100644 --- a/src/corelib/io/qfilesystemengine_symbian.cpp +++ b/src/corelib/io/qfilesystemengine_symbian.cpp @@ -237,12 +237,19 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea if (!abspath.endsWith(QLatin1Char('\\'))) abspath.append(QLatin1Char('\\')); TInt r; + TPtrC symPath(qt_QString2TPtrC(abspath)); if (createParents) - r = qt_s60GetRFs().MkDirAll(qt_QString2TPtrC(abspath)); + r = qt_s60GetRFs().MkDirAll(symPath); else - r = qt_s60GetRFs().MkDir(qt_QString2TPtrC(abspath)); + r = qt_s60GetRFs().MkDir(symPath); if (createParents && r == KErrAlreadyExists) return true; //# Qt5 - QDir::mkdir returns false for existing dir, QDir::mkpath returns true (should be made consistent in Qt 5) + if (createParents && r == KErrPermissionDenied) { + // check for already exists, which is not returned from RFs when it denies permission + TEntry entry; + if (qt_s60GetRFs().Entry(symPath, entry) == KErrNone) + r = KErrNone; + } return (r == KErrNone); } |