Basic validation of added scenery paths.
Try to catch uses adding parent directories and hence missing scenery.
This commit is contained in:
parent
227087b3a8
commit
a83947edbf
1 changed files with 19 additions and 0 deletions
|
@ -102,6 +102,25 @@ void AddOnsPage::onAddSceneryPath()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose scenery folder"));
|
QString path = QFileDialog::getExistingDirectory(this, tr("Choose scenery folder"));
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
|
// validation
|
||||||
|
|
||||||
|
SGPath p(path.toStdString());
|
||||||
|
SGPath objectsPath = p / "Objects";
|
||||||
|
SGPath terrainPath = p / "Terrain";
|
||||||
|
|
||||||
|
if (!objectsPath.exists() && !terrainPath.exists()) {
|
||||||
|
QMessageBox mb;
|
||||||
|
mb.setText(QString("The folder '%1' doesn't appear to contain scenery - add anyway?").arg(path));
|
||||||
|
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||||
|
mb.setDefaultButton(QMessageBox::No);
|
||||||
|
mb.setInformativeText("Added scenery should contain folders called 'Objects' and / or 'Terrain'");
|
||||||
|
mb.exec();
|
||||||
|
|
||||||
|
if (mb.result() == QMessageBox::No) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_ui->sceneryPathsList->addItem(path);
|
m_ui->sceneryPathsList->addItem(path);
|
||||||
saveSceneryPaths();
|
saveSceneryPaths();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue