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()
|
||||
{
|
||||
|
@ -67,6 +67,7 @@ slots:
|
||||
void on_instDirBrowseBtn_clicked();
|
||||
void on_modsDirBrowseBtn_clicked();
|
||||
void on_iconsDirBrowseBtn_clicked();
|
||||
void on_migrateDataFolderMacBtn_clicked();
|
||||
|
||||
/*!
|
||||
* Updates the list of update channels in the combo box.
|
||||
|
@ -157,6 +157,13 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="migrateDataFolderMacBtn">
|
||||
<property name="text">
|
||||
<string>Move MultiMC data to new location (will restart MultiMC)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
Reference in New Issue
Block a user