@@ -65,6 +65,23 @@ void SettingsDialog::addPlugins(const std::vector<IPlugin*> &plugins)
6565
6666void SettingsDialog::accept ()
6767{
68+ QString newModPath = ui->modDirEdit ->text ();
69+ newModPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
70+
71+ if ((QDir::fromNativeSeparators (newModPath) !=
72+ QDir::fromNativeSeparators (
73+ Settings::instance ().getModDirectory (true ))) &&
74+ (QMessageBox::question (
75+ nullptr , tr (" Confirm" ),
76+ tr (" Changing the mod directory affects all your profiles! "
77+ " Mods not present (or named differently) in the new location "
78+ " will be disabled in all profiles. "
79+ " There is no way to undo this unless you backed up your "
80+ " profiles manually. Proceed?" ),
81+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)) {
82+ return ;
83+ }
84+
6885 storeSettings (ui->pluginsList ->currentItem ());
6986 TutorableDialog::accept ();
7087}
@@ -112,39 +129,54 @@ void SettingsDialog::on_browseBaseDirBtn_clicked()
112129
113130void SettingsDialog::on_browseDownloadDirBtn_clicked ()
114131{
115- QString temp = QFileDialog::getExistingDirectory (this , tr (" Select download directory" ), ui->downloadDirEdit ->text ());
132+ QString searchPath = ui->downloadDirEdit ->text ();
133+ searchPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
134+
135+ QString temp = QFileDialog::getExistingDirectory (this , tr (" Select download directory" ), searchPath);
116136 if (!temp.isEmpty ()) {
117137 ui->downloadDirEdit ->setText (temp);
118138 }
119139}
120140
121141void SettingsDialog::on_browseModDirBtn_clicked ()
122142{
123- QString temp = QFileDialog::getExistingDirectory (this , tr (" Select mod directory" ), ui->modDirEdit ->text ());
143+ QString searchPath = ui->modDirEdit ->text ();
144+ searchPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
145+
146+ QString temp = QFileDialog::getExistingDirectory (this , tr (" Select mod directory" ), searchPath);
124147 if (!temp.isEmpty ()) {
125148 ui->modDirEdit ->setText (temp);
126149 }
127150}
128151
129152void SettingsDialog::on_browseCacheDirBtn_clicked ()
130153{
131- QString temp = QFileDialog::getExistingDirectory (this , tr (" Select cache directory" ), ui->cacheDirEdit ->text ());
154+ QString searchPath = ui->cacheDirEdit ->text ();
155+ searchPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
156+
157+ QString temp = QFileDialog::getExistingDirectory (this , tr (" Select cache directory" ), searchPath);
132158 if (!temp.isEmpty ()) {
133159 ui->cacheDirEdit ->setText (temp);
134160 }
135161}
136162
137163void SettingsDialog::on_browseProfilesDirBtn_clicked ()
138164{
139- QString temp = QFileDialog::getExistingDirectory (this , tr (" Select profiles directory" ), ui->profilesDirEdit ->text ());
165+ QString searchPath = ui->profilesDirEdit ->text ();
166+ searchPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
167+
168+ QString temp = QFileDialog::getExistingDirectory (this , tr (" Select profiles directory" ), searchPath);
140169 if (!temp.isEmpty ()) {
141170 ui->profilesDirEdit ->setText (temp);
142171 }
143172}
144173
145174void SettingsDialog::on_browseOverwriteDirBtn_clicked ()
146175{
147- QString temp = QFileDialog::getExistingDirectory (this , tr (" Select overwrite directory" ), ui->overwriteDirEdit ->text ());
176+ QString searchPath = ui->overwriteDirEdit ->text ();
177+ searchPath.replace (" %BASE_DIR%" , ui->baseDirEdit ->text ());
178+
179+ QString temp = QFileDialog::getExistingDirectory (this , tr (" Select overwrite directory" ), searchPath);
148180 if (!temp.isEmpty ()) {
149181 ui->overwriteDirEdit ->setText (temp);
150182 }
@@ -222,3 +254,4 @@ void SettingsDialog::on_clearCacheButton_clicked()
222254 QDir (Settings::instance ().getCacheDirectory ()).removeRecursively ();
223255 NexusInterface::instance ()->clearCache ();
224256}
257+
0 commit comments