GH-977 this isn't funny anymore...

This commit is contained in:
Petr Mrázek 2015-05-22 01:27:59 +02:00
parent cfdfd0e811
commit 8715746774
2 changed files with 12 additions and 13 deletions

View File

@ -301,7 +301,7 @@ void MultiMCPage::applySettings()
// FTB // FTB
s->set("TrackFTBInstances", ui->trackFtbBox->isChecked()); s->set("TrackFTBInstances", ui->trackFtbBox->isChecked());
s->set("FTBLauncherRoot", ui->ftbLauncherBox->text()); s->set("FTBLauncherLocal", ui->ftbLauncherBox->text());
s->set("FTBRoot", ui->ftbBox->text()); s->set("FTBRoot", ui->ftbBox->text());
// Folders // Folders
@ -390,7 +390,7 @@ void MultiMCPage::loadSettings()
// FTB // FTB
ui->trackFtbBox->setChecked(s->get("TrackFTBInstances").toBool()); ui->trackFtbBox->setChecked(s->get("TrackFTBInstances").toBool());
ui->ftbLauncherBox->setText(s->get("FTBLauncherRoot").toString()); ui->ftbLauncherBox->setText(s->get("FTBLauncherLocal").toString());
ui->ftbBox->setText(s->get("FTBRoot").toString()); ui->ftbBox->setText(s->get("FTBRoot").toString());
// Folders // Folders

View File

@ -35,7 +35,7 @@ inline uint qHash(FTBRecord record)
QSet<FTBRecord> discoverFTBInstances(SettingsObjectPtr globalSettings) QSet<FTBRecord> discoverFTBInstances(SettingsObjectPtr globalSettings)
{ {
QSet<FTBRecord> records; QSet<FTBRecord> records;
QDir dir = QDir(globalSettings->get("FTBLauncherDataRoot").toString()); QDir dir = QDir(globalSettings->get("FTBLauncherLocal").toString());
QDir dataDir = QDir(globalSettings->get("FTBRoot").toString()); QDir dataDir = QDir(globalSettings->get("FTBRoot").toString());
if (!dataDir.exists()) if (!dataDir.exists())
{ {
@ -269,7 +269,7 @@ void FTBPlugin::loadInstances(SettingsObjectPtr globalSettings, QMap<QString, QS
static const int APPDATA_BUFFER_SIZE = 1024; static const int APPDATA_BUFFER_SIZE = 1024;
#endif #endif
static QString getCacheStorageLocation() static QString getLocalCacheStorageLocation()
{ {
QString ftbDefault; QString ftbDefault;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
@ -296,7 +296,7 @@ static QString getCacheStorageLocation()
} }
static QString getDynamicStorageLocation() static QString getRoamingStorageLocation()
{ {
QString ftbDefault; QString ftbDefault;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
@ -322,20 +322,19 @@ void FTBPlugin::initialize(SettingsObjectPtr globalSettings)
{ {
// FTB // FTB
globalSettings->registerSetting("TrackFTBInstances", false); globalSettings->registerSetting("TrackFTBInstances", false);
QString ftbDataDefault = getDynamicStorageLocation(); QString ftbRoaming = getRoamingStorageLocation();
QString ftbDefault = getCacheStorageLocation(); QString ftbLocal = getLocalCacheStorageLocation();
globalSettings->registerSetting("FTBLauncherDataRoot", ftbDataDefault); globalSettings->registerSetting("FTBLauncherRoaming", ftbRoaming);
globalSettings->registerSetting("FTBLauncherRoot", ftbDefault); globalSettings->registerSetting("FTBLauncherLocal", ftbLocal);
qDebug() << "FTB Launcher paths:" << globalSettings->get("FTBLauncherDataRoot").toString() qDebug() << "FTB Launcher paths:" << globalSettings->get("FTBLauncherRoaming").toString()
<< "and" << globalSettings->get("FTBLauncherRoot").toString(); << "and" << globalSettings->get("FTBLauncherLocal").toString();
globalSettings->registerSetting("FTBRoot"); globalSettings->registerSetting("FTBRoot");
if (globalSettings->get("FTBRoot").isNull()) if (globalSettings->get("FTBRoot").isNull())
{ {
QString ftbRoot; QString ftbRoot;
QFile f(QDir(globalSettings->get("FTBLauncherRoot").toString()) QFile f(QDir(globalSettings->get("FTBLauncherRoaming").toString()).absoluteFilePath("ftblaunch.cfg"));
.absoluteFilePath("ftblaunch.cfg"));
qDebug() << "Attempting to read" << f.fileName(); qDebug() << "Attempting to read" << f.fileName();
if (f.open(QFile::ReadOnly)) if (f.open(QFile::ReadOnly))
{ {