1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

GLideNUI: attempt to mkdir texture pack directories

This commit is contained in:
Rosalie Wanders 2020-12-22 00:46:28 +01:00 committed by Sergey Lipskiy
parent 1833971dc5
commit 6d47fa5c48

View File

@ -622,49 +622,53 @@ void ConfigDialog::accept(bool justSave) {
config.textureFilter.txHiresTextureFileStorage = ui->hiresTexFileStorageCheckBox->isChecked() ? 1 : 0; config.textureFilter.txHiresTextureFileStorage = ui->hiresTexFileStorageCheckBox->isChecked() ? 1 : 0;
QDir txPath(ui->texPackPathLineEdit->text()); QDir txPath(ui->texPackPathLineEdit->text());
if (txPath.exists()) { if (!txPath.exists() &&
config.textureFilter.txPath[txPath.absolutePath().toWCharArray(config.textureFilter.txPath)] = L'\0'; !txPath.mkdir(txPath.absolutePath()) &&
} else if (config.textureFilter.txHiresEnable != 0) { config.textureFilter.txHiresEnable != 0) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close); msgBox.setStandardButtons(QMessageBox::Close);
msgBox.setWindowTitle("GLideN64"); msgBox.setWindowTitle("GLideN64");
msgBox.setText(tr("The texture pack folder is missing. Please change the folder or turn off texture packs.")); msgBox.setText(tr("Failed to create the texture pack folder. Please change the folder or turn off texture packs."));
msgBox.exec(); msgBox.exec();
ui->tabWidget->setCurrentIndex(3); ui->tabWidget->setCurrentIndex(3);
ui->texPackPathLineEdit->setFocus(Qt::PopupFocusReason); ui->texPackPathLineEdit->setFocus(Qt::PopupFocusReason);
ui->texPackPathLineEdit->selectAll(); ui->texPackPathLineEdit->selectAll();
return; return;
} }
config.textureFilter.txPath[txPath.path().toWCharArray(config.textureFilter.txPath)] = L'\0';
QDir txCachePath(ui->texCachePathLineEdit->text()); QDir txCachePath(ui->texCachePathLineEdit->text());
if (txCachePath.exists()) { if (!txCachePath.exists() &&
config.textureFilter.txCachePath[txCachePath.absolutePath().toWCharArray(config.textureFilter.txCachePath)] = L'\0'; !txCachePath.mkdir(txCachePath.absolutePath()) &&
} else if (config.textureFilter.txHiresEnable != 0) { config.textureFilter.txHiresEnable != 0) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close); msgBox.setStandardButtons(QMessageBox::Close);
msgBox.setWindowTitle("GLideN64"); msgBox.setWindowTitle("GLideN64");
msgBox.setText(tr("The texture pack cache folder is missing. Please change the folder or turn off texture packs.")); msgBox.setText(tr("Failed to create the texture pack cache folder. Please change the folder or turn off texture packs."));
msgBox.exec(); msgBox.exec();
ui->tabWidget->setCurrentIndex(3); ui->tabWidget->setCurrentIndex(3);
ui->texCachePathLineEdit->setFocus(Qt::PopupFocusReason); ui->texCachePathLineEdit->setFocus(Qt::PopupFocusReason);
ui->texCachePathLineEdit->selectAll(); ui->texCachePathLineEdit->selectAll();
return; return;
} }
config.textureFilter.txCachePath[txCachePath.path().toWCharArray(config.textureFilter.txCachePath)] = L'\0';
QDir txDumpPath(ui->texDumpPathLineEdit->text()); QDir txDumpPath(ui->texDumpPathLineEdit->text());
if (txDumpPath.exists()) { if (!txDumpPath.exists() &&
config.textureFilter.txDumpPath[txDumpPath.absolutePath().toWCharArray(config.textureFilter.txDumpPath)] = L'\0'; !txDumpPath.mkdir(txDumpPath.absolutePath()) &&
} else if (config.textureFilter.txHiresEnable != 0 && config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) { config.textureFilter.txHiresEnable != 0 &&
config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close); msgBox.setStandardButtons(QMessageBox::Close);
msgBox.setWindowTitle("GLideN64"); msgBox.setWindowTitle("GLideN64");
msgBox.setText(tr("The texture dump folder is missing. Please change the folder or turn off dumping texture packs.")); msgBox.setText(tr("Failed to create the texture dump folder. Please change the folder or turn off dumping texture packs."));
msgBox.exec(); msgBox.exec();
ui->tabWidget->setCurrentIndex(3); ui->tabWidget->setCurrentIndex(3);
ui->texDumpPathLineEdit->setFocus(Qt::PopupFocusReason); ui->texDumpPathLineEdit->setFocus(Qt::PopupFocusReason);
ui->texDumpPathLineEdit->selectAll(); ui->texDumpPathLineEdit->selectAll();
return; return;
} }
config.textureFilter.txDumpPath[txDumpPath.path().toWCharArray(config.textureFilter.txDumpPath)] = L'\0';
// OSD settings // OSD settings
config.font.size = ui->fontSizeSpinBox->value(); config.font.size = ui->fontSizeSpinBox->value();