From f25d569ae883d738f372813e5e5a8bc9a409ef57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Mon, 27 Feb 2017 18:07:18 +0100 Subject: [PATCH] refs #868 Add CXPlaneUtil::xplane11Dir() --- src/blackmisc/simulation/xplane/xplaneutil.cpp | 17 ++++++++++++++++- src/blackmisc/simulation/xplane/xplaneutil.h | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/blackmisc/simulation/xplane/xplaneutil.cpp b/src/blackmisc/simulation/xplane/xplaneutil.cpp index 35809ac91..3c1f4d59a 100644 --- a/src/blackmisc/simulation/xplane/xplaneutil.cpp +++ b/src/blackmisc/simulation/xplane/xplaneutil.cpp @@ -95,9 +95,24 @@ namespace BlackMisc return getLastExistingPathFromFile(xplaneInstallFilePath); } + QString CXPlaneUtil::xplane11Dir() + { + QString xplaneInstallFilePath; + QString xplaneInstallFile = QStringLiteral("/x-plane_install_11.txt"); +#if defined(Q_OS_WIN) + xplaneInstallFilePath = getWindowsLocalAppDataPath() + xplaneInstallFile; +#elif defined (Q_OS_LINUX) + xplaneInstallFilePath = QDir::homePath() + QStringLiteral("/.x-plane") + xplaneInstallFile; +#elif defined (Q_OS_OSX) + xplaneInstallFilePath = QDir::homePath() + QStringLiteral("/Library/Preferences") + xplaneInstallFile; +#endif + return getLastExistingPathFromFile(xplaneInstallFilePath); + } + QString CXPlaneUtil::xplaneRootDir() { - if (!xplane10Dir().isEmpty()) { return xplane10Dir(); } + if (!xplane11Dir().isEmpty()) { return xplane11Dir(); } + else if (!xplane10Dir().isEmpty()) { return xplane10Dir(); } else if (!xplane9Dir().isEmpty()) { return xplane9Dir(); } else { return {}; } } diff --git a/src/blackmisc/simulation/xplane/xplaneutil.h b/src/blackmisc/simulation/xplane/xplaneutil.h index 5461ab14c..3619d77ed 100644 --- a/src/blackmisc/simulation/xplane/xplaneutil.h +++ b/src/blackmisc/simulation/xplane/xplaneutil.h @@ -35,6 +35,9 @@ namespace BlackMisc //! XPlane 10 directory static QString xplane10Dir(); + //! XPlane 11 directory + static QString xplane11Dir(); + //! XPlane root directory //! In case more then one XPlane version is found, the path to the highest version is used static QString xplaneRootDir();