From ce10b4c8f1a4ec256e23431eb10786291bccce4b Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 10 Jan 2015 14:18:44 +0000 Subject: [PATCH] Ask before creating the custom aircraft dir. --- src/GUI/QtLauncher.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/GUI/QtLauncher.cxx b/src/GUI/QtLauncher.cxx index 49ead834a..0d9eb2374 100644 --- a/src/GUI/QtLauncher.cxx +++ b/src/GUI/QtLauncher.cxx @@ -24,6 +24,7 @@ #include #include #include +#include // Simgear #include @@ -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); }