GH-2529 Move data path on macOS to MultiMC.app/Data
macOS seems to dislike changing files in the APPBUNDLE.app/Contents directory because it has to re-scan the directory every launch. As a result, large amounts of data there seems to cause freezes of MultiMC. Moving the default location outside of this directory, and thus the data, stops these freezes. There is also a dialogue when the user first opens the app that asks them if they'd like to migrate their data folder, if they select yes it will move it, and if they select no it will not move it and allow them to move it later with an option in settings.
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
#include "BuildConfig.h"
|
||||
#include "themes/ITheme.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
|
||||
// FIXME: possibly move elsewhere
|
||||
enum InstSortMode
|
||||
{
|
||||
@@ -78,6 +81,13 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
|
||||
}
|
||||
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
|
||||
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
|
||||
|
||||
//move mac data button
|
||||
QFile file(QDir::current().absolutePath() + "/dontmovemacdata");
|
||||
if (!file.exists())
|
||||
{
|
||||
ui->migrateDataFolderMacBtn->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
MultiMCPage::~MultiMCPage()
|
||||
@@ -146,6 +156,13 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked()
|
||||
ui->modsDirTextBox->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
void MultiMCPage::on_migrateDataFolderMacBtn_clicked()
|
||||
{
|
||||
QFile file(QDir::current().absolutePath() + "/dontmovemacdata");
|
||||
file.remove();
|
||||
QProcess::startDetached(qApp->arguments()[0]);
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
void MultiMCPage::refreshUpdateChannelList()
|
||||
{
|
||||
|
Reference in New Issue
Block a user