summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-10-26 13:13:03 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-02 15:18:44 +0100
commita025a2fcfa70e5db99411e2ec73c0a5141619ff5 (patch)
tree4afca3b2f038b174910d632c8563be343218b14d /src
parent300534fc214f2547a63594ce0891e9a54c8f33ca (diff)
Allow QStandardPaths (Mac, Windows, Unix) to be bootstrapped
This allows using QStandardPaths in one of the bootstrapped tools, if required for a future need. The Blackberry version appears to be usable in bootstrapped mode already. Change-Id: Ia4e9b9564395d2e151f8ac229ac2a2aa2982e92f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qstandardpaths.cpp5
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp9
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp11
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp7
4 files changed, 30 insertions, 2 deletions
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 4d7e359117..ccf2565fc0 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -44,8 +44,11 @@
#include <qdir.h>
#include <qfileinfo.h>
#include <qhash.h>
+
+#ifndef QT_BOOTSTRAPPED
#include <qobject.h>
#include <qcoreapplication.h>
+#endif
#ifndef QT_NO_STANDARDPATHS
@@ -300,7 +303,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
an empty QString if no relevant location can be found.
*/
-#ifndef Q_OS_MAC
+#if !defined(Q_OS_MAC) && !defined(QT_BOOTSTRAPPED)
QString QStandardPaths::displayName(StandardLocation type)
{
switch (type) {
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index 20a7dcffd6..068bfb45d5 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -42,7 +42,10 @@
#include "qstandardpaths.h"
#include <qdir.h>
#include <private/qcore_mac_p.h>
+
+#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
+#endif
#include <ApplicationServices/ApplicationServices.h>
@@ -101,12 +104,16 @@ static QString getFullPath(const FSRef &ref)
static void appendOrganizationAndApp(QString &path)
{
+#ifndef QT_BOOTSTRAPPED
const QString org = QCoreApplication::organizationName();
if (!org.isEmpty())
path += QLatin1Char('/') + org;
const QString appName = QCoreApplication::applicationName();
if (!appName.isEmpty())
path += QLatin1Char('/') + appName;
+#else
+ Q_UNUSED(path);
+#endif
}
static QString macLocation(QStandardPaths::StandardLocation type, short domain)
@@ -180,6 +187,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
return dirs;
}
+#ifndef QT_BOOTSTRAPPED
QString QStandardPaths::displayName(StandardLocation type)
{
if (QStandardPaths::HomeLocation == type)
@@ -197,5 +205,6 @@ QString QStandardPaths::displayName(StandardLocation type)
return static_cast<QString>(displayName);
}
+#endif
QT_END_NAMESPACE
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 822c687c89..3fb36589d2 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -44,23 +44,30 @@
#include <qfile.h>
#include <qhash.h>
#include <qtextstream.h>
-#include <qcoreapplication.h>
#include <private/qfilesystemengine_p.h>
#include <errno.h>
#include <stdlib.h>
+#ifndef QT_BOOTSTRAPPED
+#include <qcoreapplication.h>
+#endif
+
#ifndef QT_NO_STANDARDPATHS
QT_BEGIN_NAMESPACE
static void appendOrganizationAndApp(QString &path)
{
+#ifndef QT_BOOTSTRAPPED
const QString org = QCoreApplication::organizationName();
if (!org.isEmpty())
path += QLatin1Char('/') + org;
const QString appName = QCoreApplication::applicationName();
if (!appName.isEmpty())
path += QLatin1Char('/') + appName;
+#else
+ Q_UNUSED(path);
+#endif
}
QString QStandardPaths::writableLocation(StandardLocation type)
@@ -141,6 +148,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
break;
}
+#ifndef QT_BOOTSTRAPPED
// http://www.freedesktop.org/wiki/Software/xdg-user-dirs
QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
if (xdgConfigHome.isEmpty())
@@ -199,6 +207,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
}
}
}
+#endif
QString path;
switch (type) {
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index d7d73eecfc..bcd5097b14 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -44,7 +44,10 @@
#include <qdir.h>
#include <private/qsystemlibrary_p.h>
#include <qstringlist.h>
+
+#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
+#endif
#include <qt_windows.h>
#include <shlobj.h>
@@ -107,12 +110,14 @@ QString QStandardPaths::writableLocation(StandardLocation type)
result = convertCharArray(path);
if (isTestModeEnabled())
result += QLatin1String("/qttest");
+#ifndef QT_BOOTSTRAPPED
if (type != GenericDataLocation) {
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
if (!QCoreApplication::applicationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::applicationName();
}
+#endif
break;
case DesktopLocation:
@@ -189,10 +194,12 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) {
QString result = convertCharArray(path);
if (type != GenericDataLocation) {
+#ifndef QT_BOOTSTRAPPED
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
if (!QCoreApplication::applicationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::applicationName();
+#endif
}
dirs.append(result);
}