diff options
author | Hamish Arblaster <hamarb123@gmail.com> | 2021-07-02 09:19:55 +1000 |
---|---|---|
committer | Hamish Arblaster <hamarb123@gmail.com> | 2021-07-11 09:36:21 +1000 |
commit | e883cf2359428a46970437d0fa5fee676f130fcd (patch) | |
tree | b17ec700f4decad302500e26be32c5ae1e2742d4 /application/pages | |
parent | 417994735a4823782f0f2304695347a13eed9a1d (diff) | |
download | PrismLauncher-e883cf2359428a46970437d0fa5fee676f130fcd.tar.gz PrismLauncher-e883cf2359428a46970437d0fa5fee676f130fcd.tar.bz2 PrismLauncher-e883cf2359428a46970437d0fa5fee676f130fcd.zip |
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.
Diffstat (limited to 'application/pages')
-rw-r--r-- | application/pages/global/MultiMCPage.cpp | 17 | ||||
-rw-r--r-- | application/pages/global/MultiMCPage.h | 1 | ||||
-rw-r--r-- | application/pages/global/MultiMCPage.ui | 7 |
3 files changed, 25 insertions, 0 deletions
diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp index 80d5c544..d383e6ed 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCPage.cpp @@ -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() { diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCPage.h index e81832eb..fae75bf2 100644 --- a/application/pages/global/MultiMCPage.h +++ b/application/pages/global/MultiMCPage.h @@ -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. diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui index ea034919..4ad20242 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCPage.ui @@ -158,6 +158,13 @@ </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"> <enum>Qt::Vertical</enum> |