From 99c792dd4be4e8025ba465e10ff24842167266f1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 7 Mar 2017 19:30:44 +0100 Subject: [PATCH] Refs #868 Use CXPlaneUtil::xplaneRootDir() in the X-Plane plugin --- src/blackmisc/simulation/xplane/xplaneutil.cpp | 14 +++----------- .../xplaneconfig/simulatorxplaneconfigwindow.cpp | 4 +--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/blackmisc/simulation/xplane/xplaneutil.cpp b/src/blackmisc/simulation/xplane/xplaneutil.cpp index 3c1f4d59a..ffb3ad5cc 100644 --- a/src/blackmisc/simulation/xplane/xplaneutil.cpp +++ b/src/blackmisc/simulation/xplane/xplaneutil.cpp @@ -140,17 +140,9 @@ namespace BlackMisc return xbusLegacy; } } - if (!xplane10Dir().isEmpty()) - { - QString xbusLegacy = xplane10Dir() + legacyPath; - if (QDir(xbusLegacy).exists()) - { - return xbusLegacy; - } - } - if (!xplane9Dir().isEmpty()) - { - QString xbusLegacy = xplane9Dir() + legacyPath; + + for (auto func: {&CXPlaneUtil::xplane11Dir, &CXPlaneUtil::xplane10Dir, &CXPlaneUtil::xplane9Dir}) { + QString xbusLegacy = func() + legacyPath; if (QDir(xbusLegacy).exists()) { return xbusLegacy; diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp index 7d0f0dcaf..8035328d5 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp @@ -83,9 +83,7 @@ namespace BlackSimPlugin void CSimulatorXPlaneConfigWindow::ps_installXBus() { - QString xPlaneLocation = BlackMisc::Simulation::XPlane::CXPlaneUtil::xplane10Dir(); - if (xPlaneLocation.isEmpty()) - xPlaneLocation = BlackMisc::Simulation::XPlane::CXPlaneUtil::xplane9Dir(); + QString xPlaneLocation = BlackMisc::Simulation::XPlane::CXPlaneUtil::xplaneRootDir(); QString path = QFileDialog::getExistingDirectory(parentWidget(), tr("Choose your X-Plane install directory"),