summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-05-23 18:19:20 +0200
committerJan Dalheimer <jan@dalheimer.de>2014-05-23 18:19:20 +0200
commit15920aa9d0930a4403c4c9673cb7aeff650a8691 (patch)
treed97ef46183eff209b455f8fda18fdf9367de8202 /MultiMC.cpp
parente17364de6bcb838afc4a9e983cc175f9a66d9d9a (diff)
downloadMultiMC-15920aa9d0930a4403c4c9673cb7aeff650a8691.tar
MultiMC-15920aa9d0930a4403c4c9673cb7aeff650a8691.tar.gz
MultiMC-15920aa9d0930a4403c4c9673cb7aeff650a8691.tar.lz
MultiMC-15920aa9d0930a4403c4c9673cb7aeff650a8691.tar.xz
MultiMC-15920aa9d0930a4403c4c9673cb7aeff650a8691.zip
Attempt at fixing FTB
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp53
1 files changed, 17 insertions, 36 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 82b0e207..4918ba10 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -358,9 +358,9 @@ void MultiMC::initGlobalSettings()
// FTB
m_settings->registerSetting("TrackFTBInstances", false);
- m_settings->registerSetting("FTBLauncherRoot");
+ QString ftbDataDefault;
#ifdef Q_OS_LINUX
- QString ftbDefault = QDir::home().absoluteFilePath(".ftblauncher");
+ QString ftbDefault = ftbDataDefault = QDir::home().absoluteFilePath(".ftblauncher");
#elif defined(Q_OS_WIN32)
wchar_t buf[APPDATA_BUFFER_SIZE];
wchar_t newBuf[APPDATA_BUFFER_SIZE];
@@ -372,51 +372,32 @@ void MultiMC::initGlobalSettings()
else
{
newFtbDefault = QDir(QString::fromWCharArray(newBuf)).absoluteFilePath("ftblauncher");
- QLOG_DEBUG() << "New FTB path from environment variable:" << QString::fromWCharArray(newBuf) << newFtbDefault;
}
- if (!QFile::exists(QDir(newFtbDefault).absoluteFilePath("ftblaunch.cfg")))
+ if (!GetEnvironmentVariableW(L"APPDATA", buf, APPDATA_BUFFER_SIZE))
{
- if (!GetEnvironmentVariableW(L"APPDATA", buf, APPDATA_BUFFER_SIZE))
- {
- QLOG_FATAL() << "Your APPDATA folder is missing! If you are on windows, this means your system is broken. If you aren't on windows, how the **** are you running the windows build????";
- }
- else
- {
- oldFtbDefault = QDir(QString::fromWCharArray(buf)).absoluteFilePath("ftblauncher");
- QLOG_DEBUG() << "Old FTB path from environment variable" << QString::fromWCharArray(buf) << oldFtbDefault;
- if (QFile::exists(QDir(oldFtbDefault).absoluteFilePath("ftblaunch.cfg")))
- {
- QLOG_INFO() << "Using old FTB path";
- ftbDefault = oldFtbDefault;
- }
- else
- {
- QLOG_INFO() << "No FTB detected";
- }
- }
+ QLOG_FATAL() << "Your APPDATA folder is missing! If you are on windows, this means your system is broken. If you aren't on windows, how the **** are you running the windows build????";
}
else
{
- QLOG_INFO() << "Using new FTB path";
- ftbDefault = newFtbDefault;
+ oldFtbDefault = QDir(QString::fromWCharArray(buf)).absoluteFilePath("ftblauncher");
}
- QLOG_INFO() << "Default FTB path:" << ftbDefault;
- if (m_settings->get("FTBLauncherRoot").toString().isEmpty()
- || (m_settings->get("FTBLauncherRoot").toString() == oldFtbDefault
- && ftbDefault != oldFtbDefault))
+ if (QFile::exists(QDir(newFtbDefault).absoluteFilePath("ftblaunch.cfg")))
{
- QLOG_DEBUG() << "Resetting FTB path";
- m_settings->set("FTBLauncherRoot", QString());
+ QLOG_INFO() << "Old FTB setup";
+ ftbDefault = ftbDataDefault = oldFtbDefault;
+ }
+ else
+ {
+ QLOG_INFO() << "New FTB setup";
+ ftbDefault = oldFtbDefault;
+ ftbDataDefault = newFtbDefault;
}
#elif defined(Q_OS_MAC)
- QString ftbDefault =
+ QString ftbDefault = ftbDataDefault =
PathCombine(QDir::homePath(), "Library/Application Support/ftblauncher");
#endif
- if (m_settings->get("FTBLauncherRoot").toString().isEmpty())
- {
- m_settings->set("FTBLauncherRoot", ftbDefault);
- }
- QLOG_INFO() << "FTB Launcher located at" << m_settings->get("FTBLauncherRoot").toString();
+ m_settings->registerSetting("FTBLauncherDataRoot", ftbDataDefault);
+ m_settings->registerSetting("FTBLauncherRoot", ftbDefault);
m_settings->registerSetting("FTBRoot");
if (m_settings->get("FTBRoot").isNull())