summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-09-23 14:53:59 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-09-23 18:19:13 (GMT)
commit930461946ce14051e56a3d7f49e2cd24742b8777 (patch)
treeca60428e382b79dd776317dc209bd0ea4601a2cb
parenta0e677ef0468fdf2d8f04e1b64312a3d9881be5f (diff)
downloadQt-930461946ce14051e56a3d7f49e2cd24742b8777.zip
Qt-930461946ce14051e56a3d7f49e2cd24742b8777.tar.gz
Qt-930461946ce14051e56a3d7f49e2cd24742b8777.tar.bz2
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
-rw-r--r--src/corelib/kernel/qcore_symbian_p.cpp19
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp6
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 <string>
#include <in_sock.h>
+#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