]> git.mxchange.org Git - flightgear.git/commitdiff
Ask before creating the custom aircraft dir.
authorJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 14:18:44 +0000 (14:18 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 14:18:44 +0000 (14:18 +0000)
src/GUI/QtLauncher.cxx

index 49ead834ac9c5ff970ef27ca0310e2d37470b3b6..0d9eb2374ec1026bbe79819277a6d4c34c9ccd76 100644 (file)
@@ -24,6 +24,7 @@
 #include <QStyledItemDelegate>
 #include <QLinearGradient>
 #include <QFileDialog>
+#include <QMessageBox>
 
 // Simgear
 #include <simgear/timing/timestamp.hxx>
@@ -1080,6 +1081,20 @@ void QtLauncher::setAirport(FGAirportRef ref)
 
 void QtLauncher::onOpenCustomAircraftDir()
 {
+    QFileInfo info(m_customAircraftDir);
+    if (!info.exists()) {
+        int result = QMessageBox::question(this, "Create folder?",
+                                           "The custom aircraft folder does not exist, create it now?",
+                                           QMessageBox::Yes | QMessageBox::No,
+                                           QMessageBox::Yes);
+        if (result == QMessageBox::No) {
+            return;
+        }
+
+        QDir d(m_customAircraftDir);
+        d.mkpath(m_customAircraftDir);
+    }
+
   QUrl u = QUrl::fromLocalFile(m_customAircraftDir);
   QDesktopServices::openUrl(u);
 }