mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T103, moved directory functions from CBuildConfig to CDirectoryUtils
getApplicationDir renamed to getBinDir() as it works different on MacOs see https://dev.swift-project.org/w/dev/swiftpc/dirstructure/
This commit is contained in:
committed by
Mathew Sutcliffe
parent
eaac4dacd6
commit
debd9c802f
@@ -124,217 +124,12 @@ namespace BlackConfig
|
||||
}
|
||||
}
|
||||
|
||||
QString getApplicationDirImpl()
|
||||
{
|
||||
QFileInfo executable(QCoreApplication::applicationFilePath());
|
||||
QDir p(executable.dir());
|
||||
return p.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getApplicationDir()
|
||||
{
|
||||
static const QString s(getApplicationDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
bool isAppBundle()
|
||||
{
|
||||
QDir bundleDir(CBuildConfig::getApplicationDir());
|
||||
bundleDir.cd("../..");
|
||||
static const bool isBundled = QFileInfo(bundleDir.absolutePath()).isBundle();
|
||||
return isBundled;
|
||||
}
|
||||
|
||||
QString getSwiftShareDirImpl()
|
||||
{
|
||||
QDir dir(CBuildConfig::getApplicationDir());
|
||||
bool success = true;
|
||||
|
||||
static const bool appBundle = isAppBundle();
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform() && appBundle)
|
||||
{
|
||||
success = dir.cd("../../../../share");
|
||||
}
|
||||
else { success = dir.cd("../share"); }
|
||||
|
||||
if (success)
|
||||
{
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "missing dir");
|
||||
return "";
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getSwiftShareDir()
|
||||
{
|
||||
static const QString s(getSwiftShareDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString getBootstrapResourceFileImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QFile file(QDir::cleanPath(d + QDir::separator() + "shared/boostrap/boostrap.json"));
|
||||
Q_ASSERT_X(file.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return QFileInfo(file).absoluteFilePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getBootstrapResourceFile()
|
||||
{
|
||||
static const QString s(getBootstrapResourceFileImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getSwiftStaticDbFilesDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "shared/dbdata"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getSwiftStaticDbFilesDir()
|
||||
{
|
||||
static QString s(getSwiftStaticDbFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getSoundFilesDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "sounds"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getSoundFilesDir()
|
||||
{
|
||||
static QString s(getSoundFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getStylesheetsDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "qss"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getStylesheetsDir()
|
||||
{
|
||||
static QString s(getStylesheetsDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getImagesDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "images"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getImagesDir()
|
||||
{
|
||||
static const QString s(getImagesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getImagesAirlinesDir()
|
||||
{
|
||||
static const QString s(QDir::cleanPath(getImagesDir() + QDir::separator() + "airlines"));
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getImagesFlagsDir()
|
||||
{
|
||||
static const QString s(QDir::cleanPath(getImagesDir() + QDir::separator() + "flags"));
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getHtmlDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "html"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getHtmlDir()
|
||||
{
|
||||
static const QString s(getHtmlDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getLegalDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "legal"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getLegalDir()
|
||||
{
|
||||
static const QString s(getLegalDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getAboutFileLocation()
|
||||
{
|
||||
static const QString about = QDir::cleanPath(CBuildConfig::getLegalDir() + QDir::separator() + "about.html");
|
||||
return about;
|
||||
}
|
||||
|
||||
QString getTestFilesDirImpl()
|
||||
{
|
||||
const QString d(CBuildConfig::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "test"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getTestFilesDir()
|
||||
{
|
||||
static QString s(getTestFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getHtmlTemplateFileName()
|
||||
{
|
||||
static const QString s(getHtmlDir() + QDir::separator() + "swifttemplate.html");
|
||||
return s;
|
||||
}
|
||||
|
||||
bool CBuildConfig::canRunInDeveloperEnvironment()
|
||||
{
|
||||
if (CBuildConfig::isDevBranch()) { return true; }
|
||||
return !CBuildConfig::isStableBranch();
|
||||
}
|
||||
|
||||
QString getDocumentationDirectoryImpl()
|
||||
{
|
||||
QStringList pathes(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation));
|
||||
QString d = pathes.first();
|
||||
d = QDir::cleanPath(d + QDir::separator() + "swift");
|
||||
QDir dir(d);
|
||||
if (dir.exists()) { return dir.absolutePath(); }
|
||||
return pathes.first();
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getDocumentationDirectory()
|
||||
{
|
||||
static const QString d(getDocumentationDirectoryImpl());
|
||||
return d;
|
||||
}
|
||||
|
||||
QString boolToYesNo(bool v)
|
||||
{
|
||||
return v ? "yes" : "no";
|
||||
|
||||
@@ -89,52 +89,6 @@ namespace BlackConfig
|
||||
//! Running on Unix (Linux or Mac OS X) platform
|
||||
static bool isRunningOnUnixPlatform();
|
||||
|
||||
//! Application directory where current application is located
|
||||
static const QString &getApplicationDir();
|
||||
|
||||
//! Where resource files (static DB files, ...) etc are located
|
||||
//! \remark share not shared (do no mix)
|
||||
static const QString &getSwiftShareDir();
|
||||
|
||||
//! Bootstrap resource directory
|
||||
static const QString &getBootstrapResourceFile();
|
||||
|
||||
//! Where static DB files are located
|
||||
static const QString &getSwiftStaticDbFilesDir();
|
||||
|
||||
//! Where sound files are located
|
||||
static const QString &getSoundFilesDir();
|
||||
|
||||
//! Where qss files are located
|
||||
static const QString &getStylesheetsDir();
|
||||
|
||||
//! Where images are located
|
||||
static const QString &getImagesDir();
|
||||
|
||||
//! Where airline images are located
|
||||
static const QString &getImagesAirlinesDir();
|
||||
|
||||
//! Where flags images are located
|
||||
static const QString &getImagesFlagsDir();
|
||||
|
||||
//! Where HTML files are located
|
||||
static const QString &getHtmlDir();
|
||||
|
||||
//! Where Legal files are located
|
||||
static const QString &getLegalDir();
|
||||
|
||||
//! The about document file location
|
||||
static const QString &getAboutFileLocation();
|
||||
|
||||
//! Where test files are located
|
||||
static const QString &getTestFilesDir();
|
||||
|
||||
//! Where HTML files are located
|
||||
static const QString &getHtmlTemplateFileName();
|
||||
|
||||
//! Directory where data can be stored
|
||||
static const QString &getDocumentationDirectory();
|
||||
|
||||
//! Info string about compilation
|
||||
static const QString &compiledWithInfo(bool shortVersion = true);
|
||||
|
||||
|
||||
@@ -1189,7 +1189,7 @@ namespace BlackCore
|
||||
if (isUnitTest()) { return CStatusMessage(this).info("No crash handler for unit tests"); }
|
||||
|
||||
static const QString crashpadHandler(CBuildConfig::isRunningOnWindowsNtPlatform() ? "swift_crashpad_handler.exe" : "swift_crashpad_handler");
|
||||
static const QString handler = CFileUtils::appendFilePaths(CDirectoryUtils::applicationDirectoryPath(), crashpadHandler);
|
||||
static const QString handler = CFileUtils::appendFilePaths(CDirectoryUtils::getBinDir(), crashpadHandler);
|
||||
static const QString crashpadPath = CDirectoryUtils::getCrashpadDirectory();
|
||||
static const QString database = CFileUtils::appendFilePaths(crashpadPath, "/database");
|
||||
static const QString metrics = CFileUtils::appendFilePaths(crashpadPath, "/metrics");
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace BlackCore
|
||||
|
||||
QString IPluginManager::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins");
|
||||
return CDirectoryUtils::getBinDir() % QStringLiteral("/plugins");
|
||||
}
|
||||
|
||||
bool IPluginManager::isValid(const QJsonObject &metadata) const
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace BlackCore
|
||||
|
||||
QString CPluginManagerSimulator::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins/simulator");
|
||||
return CDirectoryUtils::getBinDir() % QStringLiteral("/plugins/simulator");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackCore
|
||||
|
||||
QString CPluginManagerWeatherData::pluginDirectory() const
|
||||
{
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins/weatherdata");
|
||||
return CDirectoryUtils::getBinDir() % QStringLiteral("/plugins/weatherdata");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/network/url.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
@@ -31,7 +30,6 @@
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -518,7 +516,7 @@ namespace BlackCore
|
||||
CLogMessage(this).info("Setup (bootstrap already cached, no prefill needed");
|
||||
return false;
|
||||
}
|
||||
const QString fn = CBuildConfig::getBootstrapResourceFile();
|
||||
const QString fn = CDirectoryUtils::getBootstrapResourceFile();
|
||||
const CStatusMessageList msgs = this->readLocalBootstrapFile(fn);
|
||||
CLogMessage::preformatted(msgs);
|
||||
return true;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackgui/components/datainfoareacomponent.h"
|
||||
#include "blackgui/components/dbaircrafticaocomponent.h"
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "ui_datainfoareacomponent.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <QTabWidget>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackGui;
|
||||
@@ -91,7 +90,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// write to disk
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CBuildConfig::getSwiftStaticDbFilesDir());
|
||||
bool s = sGui->getWebDataServices()->writeDbDataToDisk(CDirectoryUtils::getSwiftStaticDbFilesDir());
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Written DB data");
|
||||
@@ -106,12 +105,12 @@ namespace BlackGui
|
||||
bool CDataInfoAreaComponent::readDbDataFromResourceDir()
|
||||
{
|
||||
bool s = sGui &&
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CBuildConfig::getSwiftStaticDbFilesDir(), true);
|
||||
sGui->getWebDataServices()->readDbDataFromDisk(CDirectoryUtils::getSwiftStaticDbFilesDir(), true);
|
||||
|
||||
// info
|
||||
if (s)
|
||||
{
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CBuildConfig::getSwiftStaticDbFilesDir();
|
||||
CLogMessage(this).info("Read DB data from directory: %1") << CDirectoryUtils::getSwiftStaticDbFilesDir();
|
||||
ui->comp_DbAircraftIcao->showLoadIndicator();
|
||||
ui->comp_DbAirlineIcao->showLoadIndicator();
|
||||
ui->comp_DbCountries->showLoadIndicator();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "ui_flightplancomponent.h"
|
||||
|
||||
@@ -598,7 +599,7 @@ namespace BlackGui
|
||||
QString CFlightPlanComponent::getDefaultFilename(bool load)
|
||||
{
|
||||
// some logic to find a useful default name
|
||||
QString dir = CBuildConfig::getDocumentationDirectory();
|
||||
QString dir = CDirectoryUtils::getDocumentationDirectory();
|
||||
|
||||
if (load)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include <QString>
|
||||
|
||||
namespace BlackGui
|
||||
@@ -31,7 +31,7 @@ namespace BlackGui
|
||||
static bool isValid(const QString &directory) { Q_UNUSED(directory); return true; }
|
||||
|
||||
//! Default, not consolidating
|
||||
static const QString &defaultValue() { return BlackConfig::CBuildConfig::getDocumentationDirectory(); }
|
||||
static const QString &defaultValue() { return BlackMisc::CDirectoryUtils::getDocumentationDirectory(); }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/restricted.h"
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
@@ -132,12 +133,12 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::read()
|
||||
{
|
||||
QDir directory(CBuildConfig::getStylesheetsDir());
|
||||
QDir directory(CDirectoryUtils::getStylesheetsDir());
|
||||
if (!directory.exists()) { return false; }
|
||||
|
||||
// qss/css files
|
||||
const bool needsWatcher = this->m_fileWatcher.files().isEmpty();
|
||||
if (needsWatcher) { this->m_fileWatcher.addPath(CBuildConfig::getStylesheetsDir()); } // directory to deleted file watching
|
||||
if (needsWatcher) { this->m_fileWatcher.addPath(CDirectoryUtils::getStylesheetsDir()); } // directory to deleted file watching
|
||||
directory.setNameFilters({"*.qss", "*.css"});
|
||||
directory.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
||||
|
||||
@@ -239,7 +240,7 @@ namespace BlackGui
|
||||
qssWidget.append(qss);
|
||||
qssWidget.append("}\n");
|
||||
|
||||
QFile fontFile(CBuildConfig::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
QFile fontFile(CDirectoryUtils::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
bool ok = fontFile.open(QFile::Text | QFile::WriteOnly);
|
||||
if (ok)
|
||||
{
|
||||
@@ -253,7 +254,7 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::resetFont()
|
||||
{
|
||||
QFile fontFile(CBuildConfig::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
QFile fontFile(CDirectoryUtils::getStylesheetsDir() + "/" + fileNameFontsModified());
|
||||
return fontFile.remove();
|
||||
}
|
||||
|
||||
@@ -299,7 +300,7 @@ namespace BlackGui
|
||||
|
||||
bool CStyleSheetUtility::deleteModifiedFontFile()
|
||||
{
|
||||
const QString fn = CFileUtils::appendFilePaths(CBuildConfig::getStylesheetsDir(), fileNameFontsModified());
|
||||
const QString fn = CFileUtils::appendFilePaths(CDirectoryUtils::getStylesheetsDir(), fileNameFontsModified());
|
||||
QFile file(fn);
|
||||
if (!file.exists()) { return false; }
|
||||
bool r = file.remove();
|
||||
@@ -483,7 +484,7 @@ namespace BlackGui
|
||||
bool CStyleSheetUtility::qssFileExists(const QString &filename)
|
||||
{
|
||||
if (filename.isEmpty()) { return false; }
|
||||
const QFileInfo f(CFileUtils::appendFilePaths(CBuildConfig::getStylesheetsDir(), filename));
|
||||
const QFileInfo f(CFileUtils::appendFilePaths(CDirectoryUtils::getStylesheetsDir(), filename));
|
||||
return f.exists() && f.isReadable();
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "airlineicaocode.h"
|
||||
#include "callsign.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/db/datastoreutility.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/icons.h"
|
||||
@@ -18,6 +17,7 @@
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/variant.h"
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
|
||||
@@ -481,7 +480,7 @@ namespace BlackMisc
|
||||
//! \private
|
||||
QSet<int> iconIdsImpl()
|
||||
{
|
||||
QDir dir(CBuildConfig::getImagesAirlinesDir());
|
||||
QDir dir(CDirectoryUtils::getImagesAirlinesDir());
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "image directory missing");
|
||||
|
||||
QSet<int> ids;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/range.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
@@ -20,9 +21,11 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
|
||||
using namespace BlackConfig;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
QString applicationDirectoryPathImpl()
|
||||
QString binDirectoryImpl()
|
||||
{
|
||||
QString appDirectoryString(qApp->applicationDirPath());
|
||||
if (appDirectoryString.endsWith("Contents/MacOS")) { appDirectoryString += "/../../.."; }
|
||||
@@ -30,15 +33,15 @@ namespace BlackMisc
|
||||
return appDirectory.absolutePath();
|
||||
}
|
||||
|
||||
QString CDirectoryUtils::applicationDirectoryPath()
|
||||
const QString &CDirectoryUtils::getBinDir()
|
||||
{
|
||||
static const QString appDirectory(applicationDirectoryPathImpl());
|
||||
return appDirectory;
|
||||
static const QString binDir(binDirectoryImpl());
|
||||
return binDir;
|
||||
}
|
||||
|
||||
QString normalizedApplicationDirectoryImpl()
|
||||
{
|
||||
QString appDir = CDirectoryUtils::applicationDirectoryPath();
|
||||
QString appDir = CDirectoryUtils::getBinDir();
|
||||
Q_ASSERT(appDir.size() > 0);
|
||||
// Remove leading '/' on Unix
|
||||
if (appDir.at(0) == '/') { appDir.remove(0, 1); }
|
||||
@@ -90,6 +93,198 @@ namespace BlackMisc
|
||||
return p;
|
||||
}
|
||||
|
||||
bool isAppBundleImpl()
|
||||
{
|
||||
QDir bundleDir(CDirectoryUtils::getBinDir());
|
||||
bundleDir.cd("../..");
|
||||
const bool isBundled = QFileInfo(bundleDir.absolutePath()).isBundle();
|
||||
return isBundled;
|
||||
}
|
||||
|
||||
QString getSwiftShareDirImpl()
|
||||
{
|
||||
QDir dir(CDirectoryUtils::getBinDir());
|
||||
bool success = true;
|
||||
|
||||
static const bool appBundle = isAppBundleImpl();
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform() && appBundle)
|
||||
{
|
||||
success = dir.cd("../../../../share");
|
||||
}
|
||||
else { success = dir.cd("../share"); }
|
||||
|
||||
if (success)
|
||||
{
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "missing dir");
|
||||
return "";
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getSwiftShareDir()
|
||||
{
|
||||
static const QString s(getSwiftShareDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString getBootstrapResourceFileImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QFile file(QDir::cleanPath(d + QDir::separator() + "shared/boostrap/boostrap.json"));
|
||||
Q_ASSERT_X(file.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return QFileInfo(file).absoluteFilePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getBootstrapResourceFile()
|
||||
{
|
||||
static const QString s(getBootstrapResourceFileImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getSwiftStaticDbFilesDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "shared/dbdata"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getSwiftStaticDbFilesDir()
|
||||
{
|
||||
static QString s(getSwiftStaticDbFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getSoundFilesDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "sounds"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getSoundFilesDir()
|
||||
{
|
||||
static QString s(getSoundFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getStylesheetsDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "qss"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getStylesheetsDir()
|
||||
{
|
||||
static QString s(getStylesheetsDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getImagesDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "images"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getImagesDir()
|
||||
{
|
||||
static const QString s(getImagesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getImagesAirlinesDir()
|
||||
{
|
||||
static const QString s(QDir::cleanPath(getImagesDir() + QDir::separator() + "airlines"));
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getImagesFlagsDir()
|
||||
{
|
||||
static const QString s(QDir::cleanPath(getImagesDir() + QDir::separator() + "flags"));
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getHtmlDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "html"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getHtmlDir()
|
||||
{
|
||||
static const QString s(getHtmlDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getLegalDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "legal"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getLegalDir()
|
||||
{
|
||||
static const QString s(getLegalDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getAboutFileLocation()
|
||||
{
|
||||
static const QString about = QDir::cleanPath(CDirectoryUtils::getLegalDir() + QDir::separator() + "about.html");
|
||||
return about;
|
||||
}
|
||||
|
||||
QString getTestFilesDirImpl()
|
||||
{
|
||||
const QString d(CDirectoryUtils::getSwiftShareDir());
|
||||
if (d.isEmpty()) { return ""; }
|
||||
const QDir dir(QDir::cleanPath(d + QDir::separator() + "test"));
|
||||
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
|
||||
return dir.absolutePath();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getTestFilesDir()
|
||||
{
|
||||
static QString s(getTestFilesDirImpl());
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getHtmlTemplateFileName()
|
||||
{
|
||||
static const QString s(getHtmlDir() + QDir::separator() + "swifttemplate.html");
|
||||
return s;
|
||||
}
|
||||
|
||||
QString getDocumentationDirectoryImpl()
|
||||
{
|
||||
QStringList pathes(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation));
|
||||
QString d = pathes.first();
|
||||
d = QDir::cleanPath(d + QDir::separator() + "swift");
|
||||
QDir dir(d);
|
||||
if (dir.exists()) { return dir.absolutePath(); }
|
||||
return pathes.first();
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getDocumentationDirectory()
|
||||
{
|
||||
static const QString d(getDocumentationDirectoryImpl());
|
||||
return d;
|
||||
}
|
||||
|
||||
const QString &CDirectoryUtils::getCrashpadDirectory()
|
||||
{
|
||||
static const QString p = CFileUtils::appendFilePaths(swiftNormalizedApplicationDataDirectory(), "/crashpad");
|
||||
|
||||
@@ -25,9 +25,11 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CDirectoryUtils
|
||||
{
|
||||
public:
|
||||
//! Returns the directory of the application. In contrast to QCoreApplication::applicationDirPath()
|
||||
//! it takes Mac OS X app bundles into account and returns the directory of the bundle.
|
||||
static QString applicationDirectoryPath();
|
||||
//! Returns the bin directory. On Windows/Linux this is the same directory as
|
||||
//! QCoreApplication::applicationDirPath(), but on MacOS the exceutable is
|
||||
//! located deeper in the hierarchy of the bundles
|
||||
//! \see https://dev.swift-project.org/w/dev/swiftpc/dirstructure/
|
||||
static const QString &getBinDir();
|
||||
|
||||
//! swift application data directory, contains 0..n swift installation directories
|
||||
static const QString &swiftApplicationDataDirectory();
|
||||
@@ -41,6 +43,49 @@ namespace BlackMisc
|
||||
//! swift application data directory for one specific installation (a version)
|
||||
static const QString &swiftNormalizedApplicationDataDirectory();
|
||||
|
||||
//! Where resource files (static DB files, ...) etc are located
|
||||
//! \remark share not shared (do no mix)
|
||||
static const QString &getSwiftShareDir();
|
||||
|
||||
//! Bootstrap resource directory
|
||||
static const QString &getBootstrapResourceFile();
|
||||
|
||||
//! Where static DB files are located
|
||||
static const QString &getSwiftStaticDbFilesDir();
|
||||
|
||||
//! Where sound files are located
|
||||
static const QString &getSoundFilesDir();
|
||||
|
||||
//! Where qss files are located
|
||||
static const QString &getStylesheetsDir();
|
||||
|
||||
//! Where images are located
|
||||
static const QString &getImagesDir();
|
||||
|
||||
//! Where airline images are located
|
||||
static const QString &getImagesAirlinesDir();
|
||||
|
||||
//! Where flags images are located
|
||||
static const QString &getImagesFlagsDir();
|
||||
|
||||
//! Where HTML files are located
|
||||
static const QString &getHtmlDir();
|
||||
|
||||
//! Where Legal files are located
|
||||
static const QString &getLegalDir();
|
||||
|
||||
//! The about document file location
|
||||
static const QString &getAboutFileLocation();
|
||||
|
||||
//! Where test files are located
|
||||
static const QString &getTestFilesDir();
|
||||
|
||||
//! Where HTML files are located
|
||||
static const QString &getHtmlTemplateFileName();
|
||||
|
||||
//! Directory where data can be stored
|
||||
static const QString &getDocumentationDirectory();
|
||||
|
||||
//! Directory for log files
|
||||
//! \remark In BlackMisc so it can also be used from BlackMisc classes
|
||||
static const QString &getLogDirectory();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
//! \cond PRIVATE
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <QSize>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
const QPixmap &CIcons::info16()
|
||||
@@ -1157,7 +1155,7 @@ namespace BlackMisc
|
||||
|
||||
if (!getResourceFileCache().contains(fileName))
|
||||
{
|
||||
const QString path = CFileUtils::appendFilePaths(CBuildConfig::getImagesDir(), fileName);
|
||||
const QString path = CFileUtils::appendFilePaths(CDirectoryUtils::getImagesDir(), fileName);
|
||||
QPixmap pm;
|
||||
const bool s = pm.load(path);
|
||||
getResourceFileCache().insert(fileName, s ? pm : CIcons::empty());
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/aircraftmodelutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
using namespace BlackConfig;
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
@@ -133,7 +132,7 @@ namespace BlackMisc
|
||||
BLACK_VERIFY_X(dir.exists(), Q_FUNC_INFO, "Directory does not exist");
|
||||
if (!dir.exists()) { return ""; }
|
||||
|
||||
const QString htmlTemplate = CFileUtils::readFileToString(CBuildConfig::getHtmlTemplateFileName());
|
||||
const QString htmlTemplate = CFileUtils::readFileToString(CDirectoryUtils::getHtmlTemplateFileName());
|
||||
const QString fn("airlineAircraftMatrix.html");
|
||||
const bool ok = CFileUtils::writeStringToFile(htmlTemplate.arg(html), dir.absoluteFilePath(fn));
|
||||
return ok ? dir.absoluteFilePath(fn) : "";
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (parts.isEmpty() && interpolation.isEmpty()) { return CStatusMessage(static_cast<CInterpolationLogger *>(nullptr)).warning("No data for log"); }
|
||||
static const QString html = QStringLiteral("Entries: %1\n\n%2");
|
||||
const QString htmlTemplate = CFileUtils::readFileToString(CBuildConfig::getHtmlTemplateFileName());
|
||||
const QString htmlTemplate = CFileUtils::readFileToString(CDirectoryUtils::getHtmlTemplateFileName());
|
||||
|
||||
CStatusMessageList msgs;
|
||||
const QString ts = QDateTime::currentDateTimeUtc().toString("yyyyMMddhhmmss");
|
||||
|
||||
@@ -8,16 +8,15 @@
|
||||
*/
|
||||
|
||||
#include "testdata.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/flightplan.h"
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/variantlist.h"
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -240,7 +239,7 @@ namespace BlackMisc
|
||||
|
||||
const CAircraftIcaoCode &CTestData::getDBAircraftIcaoB737()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBAircraftIcaoB737Boeing.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBAircraftIcaoB737Boeing.json");
|
||||
static const CAircraftIcaoCode icao(CAircraftIcaoCode::fromJson(json));
|
||||
Q_ASSERT(icao.hasValidDbKey());
|
||||
return icao;
|
||||
@@ -248,7 +247,7 @@ namespace BlackMisc
|
||||
|
||||
const CAircraftIcaoCode &CTestData::getDBAircraftIcaoC172()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBAircraftIcaoC172Cessna.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBAircraftIcaoC172Cessna.json");
|
||||
static const CAircraftIcaoCode icao(CAircraftIcaoCode::fromJson(json));
|
||||
Q_ASSERT(icao.hasValidDbKey());
|
||||
return icao;
|
||||
@@ -256,7 +255,7 @@ namespace BlackMisc
|
||||
|
||||
const CAirlineIcaoCode &CTestData::getDbAirlineIcaoDLH()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBAirlineIcaoDLH.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBAirlineIcaoDLH.json");
|
||||
static const CAirlineIcaoCode icao(CAirlineIcaoCode::fromJson(json));
|
||||
Q_ASSERT(icao.hasValidDbKey());
|
||||
return icao;
|
||||
@@ -264,7 +263,7 @@ namespace BlackMisc
|
||||
|
||||
const CAirlineIcaoCode &CTestData::getDbAirlineIcaoBAW()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBAirlineIcaoBAW.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBAirlineIcaoBAW.json");
|
||||
static const CAirlineIcaoCode icao(CAirlineIcaoCode::fromJson(json));
|
||||
Q_ASSERT(icao.hasValidDbKey());
|
||||
return icao;
|
||||
@@ -272,7 +271,7 @@ namespace BlackMisc
|
||||
|
||||
const CLivery &CTestData::getDbLiveryDLHStarAlliance()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBLiveryDLHStarAlliance.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBLiveryDLHStarAlliance.json");
|
||||
static const CLivery livery(CLivery::fromJson(json));
|
||||
Q_ASSERT(livery.hasValidDbKey());
|
||||
return livery;
|
||||
@@ -280,7 +279,7 @@ namespace BlackMisc
|
||||
|
||||
const CAircraftModel &CTestData::getDbAircraftModelFsxA2AC172Skyhawk()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBModelFSXA2ACessnaC172.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBModelFSXA2ACessnaC172.json");
|
||||
static const CAircraftModel model(CAircraftModel::fromDatabaseJson(Json::jsonObjectFromString(json)));
|
||||
Q_ASSERT(model.hasValidDbKey());
|
||||
Q_ASSERT(!model.getModelString().isEmpty());
|
||||
@@ -289,7 +288,7 @@ namespace BlackMisc
|
||||
|
||||
const CAircraftModel &CTestData::getDbAircraftModelFsxAerosoftA320()
|
||||
{
|
||||
static const QString json = CFileUtils::readFileToString(CBuildConfig::getTestFilesDir(), "DBModelFSXAerosoftA320.json");
|
||||
static const QString json = CFileUtils::readFileToString(CDirectoryUtils::getTestFilesDir(), "DBModelFSXAerosoftA320.json");
|
||||
static const CAircraftModel model(CAircraftModel::fromDatabaseJson(Json::jsonObjectFromString(json)));
|
||||
Q_ASSERT(model.hasValidDbKey());
|
||||
Q_ASSERT(!model.getModelString().isEmpty());
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/filedeleter.h"
|
||||
#include <QtCore/qendian.h>
|
||||
#include <math.h>
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -501,12 +500,12 @@ namespace BlackSound
|
||||
// order here is crucial, needs to be the same as in CSoundGenerator::Notification
|
||||
if (!playlist) playlist = new QMediaPlaylist(mediaPlayer);
|
||||
bool success = true;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/error.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/login.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/logoff.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/privatemessage.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/voiceroomjoined.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CBuildConfig::getSoundFilesDir() + "/voiceroomleft.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/error.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/login.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/logoff.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/privatemessage.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/voiceroomjoined.wav")) && success;
|
||||
success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::getSoundFilesDir() + "/voiceroomleft.wav")) && success;
|
||||
|
||||
Q_ASSERT(success);
|
||||
playlist->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
|
||||
@@ -546,5 +545,4 @@ namespace BlackSound
|
||||
out << qd.deviceName() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace
|
||||
{
|
||||
QString xSwiftBusOriginDir()
|
||||
{
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/../xswiftbus");
|
||||
return CDirectoryUtils::getBinDir() % QStringLiteral("/../xswiftbus");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackgui/components/datainfoareacomponent.h"
|
||||
#include "blackgui/components/datamaininfoareacomponent.h"
|
||||
#include "blackgui/components/dbmappingcomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "swiftdata.h"
|
||||
#include "ui_swiftdata.h"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui::Components;
|
||||
@@ -56,7 +55,7 @@ void CSwiftData::initDynamicMenus()
|
||||
Q_ASSERT_X(ui->comp_MainInfoArea, Q_FUNC_INFO, "missing main area");
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
|
||||
|
||||
QString resourceDir(CBuildConfig::getSwiftShareDir());
|
||||
QString resourceDir(CDirectoryUtils::getSwiftShareDir());
|
||||
if (!resourceDir.isEmpty() && QDir(resourceDir).exists())
|
||||
{
|
||||
Q_ASSERT_X(ui->comp_MainInfoArea, Q_FUNC_INFO, "Missing main info area");
|
||||
|
||||
@@ -197,7 +197,7 @@ void CSwiftLauncher::loadAbout()
|
||||
// workaround:
|
||||
// 1) Only reading as HTML gives proper formatting
|
||||
// 2) Reading the file resource fails (likely because of the style sheet)
|
||||
static const QString html = CFileUtils::readFileToString(CBuildConfig::getAboutFileLocation());
|
||||
static const QString html = CFileUtils::readFileToString(CDirectoryUtils::getAboutFileLocation());
|
||||
static const QString legalDir = sGui->getGlobalSetup().getLegalDirectoryUrl().getFullUrl();
|
||||
|
||||
// make links absolute
|
||||
@@ -265,7 +265,7 @@ void CSwiftLauncher::startSwiftCore()
|
||||
// I set this for debug purpose only
|
||||
m_executableArgs = args;
|
||||
m_executable.clear();
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::applicationDirectoryPath(), CBuildConfig::swiftCoreExecutableName());
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::getBinDir(), CBuildConfig::swiftCoreExecutableName());
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
||||
{
|
||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
||||
@@ -281,7 +281,7 @@ void CSwiftLauncher::startSwiftCore()
|
||||
void CSwiftLauncher::setSwiftDataExecutable()
|
||||
{
|
||||
m_executable.clear();
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::applicationDirectoryPath(), CBuildConfig::swiftDataExecutableName());
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::getBinDir(), CBuildConfig::swiftDataExecutableName());
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
||||
{
|
||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
||||
@@ -293,7 +293,7 @@ void CSwiftLauncher::setSwiftDataExecutable()
|
||||
bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
{
|
||||
m_executable.clear();
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::applicationDirectoryPath(), CBuildConfig::swiftGuiExecutableName());
|
||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::getBinDir(), CBuildConfig::swiftGuiExecutableName());
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
||||
{
|
||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
||||
|
||||
Reference in New Issue
Block a user