From 930461946ce14051e56a3d7f49e2cd24742b8777 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 23 Sep 2011 15:53:59 +0100 Subject: Symbian - perform some FS initialisation previously done by open c When using Qt 4.6 and 4.7, the working directory is set to the same drive the application is installed on by the open c library. The default working directory in symbian is always the private directory on the system drive, but we told people to rely on the open c behaviour. Open C also creates the private path on both the system and installation drives when the application is started. This behaviour is also replicated now in Qt 4.8 for backward compatibility of apps that may rely on it. Similar code to create the private path on the installation drive in QCoreApplication::applicationDirPath() has been removed, as the new code in this patch is always executed first. Task-Number: QTBUG-21527 Reviewed-By: mread --- src/corelib/kernel/qcore_symbian_p.cpp | 19 +++++++++++++++++++ src/corelib/kernel/qcoreapplication.cpp | 6 ------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 04acfb0..57ae2af 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -45,6 +45,7 @@ #include "qcore_symbian_p.h" #include #include +#include "qdebug.h" QT_BEGIN_NAMESPACE @@ -115,6 +116,24 @@ public: QS60RFsSession() { qt_symbian_throwIfError(iFs.Connect()); qt_symbian_throwIfError(iFs.ShareProtected()); + //BC with 4.7: create private path on system drive + TInt sysdrive = iFs.GetSystemDrive(); + TInt err = iFs.CreatePrivatePath(sysdrive); + if (err != KErrNone && err != KErrAlreadyExists) + qWarning("Failed to create private path on system drive."); + //BC with 4.7: set working directory to same drive as application + TFileName pfn = RProcess().FileName(); + TInt drive; + if (pfn.Length() > 0 && iFs.CharToDrive(pfn[0], drive) == KErrNone) { + // for system drive or rom based apps, leave the path on system drive + if (drive != sysdrive && drive != EDriveZ) { + err = iFs.CreatePrivatePath(drive); + if (err == KErrNone || err == KErrAlreadyExists) + iFs.SetSessionToPrivate(drive); + else + qWarning("Failed to create private path on application drive."); + } + } } ~QS60RFsSession() { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 752bbaa..c4a9e40 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1991,12 +1991,6 @@ QString QCoreApplication::applicationDirPath() appPath = qt_TDesC2QString(privatePath); appPath.prepend(QLatin1Char(':')).prepend(qDriveChar); - // Create the appPath if it doesn't exist. Non-existing appPath will cause - // Platform Security violations later on if the app doesn't have AllFiles capability. - err = fs.CreatePrivatePath(drive); - if (err != KErrNone) - qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); - d->cachedApplicationDirPath = QFileInfo(appPath).path(); } #else -- cgit v0.12