Commit 00b2e224 authored by Rafał Malinowski's avatar Rafał Malinowski

misc: move handling CONFIG_DIR up

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent e01515bb
......@@ -231,7 +231,7 @@ int main(int argc, char *argv[]) try
}
// It has to be called after putting CONFIG_DIR environment variable.
KaduPaths::createInstance();
KaduPaths::createInstance(qgetenv("CONFIG_DIR"));
if (0 != qgetenv("SAVE_STDERR").toInt())
{
......
......@@ -34,10 +34,10 @@
KaduPaths * KaduPaths::Instance;
void KaduPaths::createInstance()
void KaduPaths::createInstance(const QString &customProfileDir)
{
if (!Instance)
Instance = new KaduPaths();
Instance = new KaduPaths(customProfileDir);
}
void KaduPaths::destroyInstance()
......@@ -79,10 +79,10 @@ QString KaduPaths::webKitPath(const QString &path)
#endif
}
KaduPaths::KaduPaths()
KaduPaths::KaduPaths(const QString &customProfileDir)
{
initBasicPaths();
initProfilePath();
initProfilePath(customProfileDir);
}
void KaduPaths::initBasicPaths()
......@@ -113,7 +113,7 @@ void KaduPaths::initBasicPaths()
PluginsLibPath = canonicalPath + '/';
}
void KaduPaths::initProfilePath()
void KaduPaths::initProfilePath(const QString &customProfileDir)
{
#if defined(Q_OS_MAC)
const QString defaultConfigDirRelativeToHome = QLatin1String("Library/Kadu");
......@@ -126,7 +126,6 @@ void KaduPaths::initProfilePath()
const QString oldMidConfigDir = QLatin1String("kadu");
#endif
QString customProfileDir = qgetenv("CONFIG_DIR");
if (customProfileDir.isEmpty())
{
if (QFileInfo(dataPath() + QLatin1String("portable")).exists())
......
......@@ -46,13 +46,13 @@ class KADUAPI KaduPaths
QString PluginsLibPath;
QString DataPath;
KaduPaths();
KaduPaths(const QString &customProfileDir);
void initBasicPaths();
void initProfilePath();
void initProfilePath(const QString &customProfileDir);
public:
static void createInstance();
static void createInstance(const QString &customProfileDir);
static void destroyInstance();
static KaduPaths * instance() { return Instance; }
......@@ -123,7 +123,7 @@ public:
* Default library path for plugins is $CMAKE_INSTALL_FULL_LIBDIR/kadu/plugins
* on X11 and $CMAKE_INSTALL_PREFIX/plugins on Windows. It can be overwritten by
* KADU_INSTALL_PLUGINS_LIB_DIR CMake argument.
*/
*/
const QString & pluginsLibPath() const { return PluginsLibPath; }
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment