mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 17:30:12 +08:00
Ref T103, executable file path moved to CDirectoryUtils::executableFilePath
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3245ff4ef4
commit
caf358401f
@@ -50,6 +50,13 @@ namespace BlackConfig
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBuildConfig::isKnownExecutableName(const QString &executable)
|
||||||
|
{
|
||||||
|
return executable == CBuildConfig::swiftCoreExecutableName() ||
|
||||||
|
executable == CBuildConfig::swiftDataExecutableName() ||
|
||||||
|
executable == CBuildConfig::swiftGuiExecutableName();
|
||||||
|
}
|
||||||
|
|
||||||
bool CBuildConfig::isRunningOnWindowsNtPlatform()
|
bool CBuildConfig::isRunningOnWindowsNtPlatform()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace BlackConfig
|
namespace BlackConfig
|
||||||
{
|
{
|
||||||
//! Build configuration
|
//! Build configuration, also used to secure VATSIM key
|
||||||
class CBuildConfig
|
class CBuildConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -101,6 +101,9 @@ namespace BlackConfig
|
|||||||
//! Executable name for swift data, no(!) appendix
|
//! Executable name for swift data, no(!) appendix
|
||||||
static const QString &swiftDataExecutableName();
|
static const QString &swiftDataExecutableName();
|
||||||
|
|
||||||
|
//! Known executable
|
||||||
|
static bool isKnownExecutableName(const QString &executable);
|
||||||
|
|
||||||
//! End of lifetime
|
//! End of lifetime
|
||||||
static const QDateTime &getEol(); // defined in buildconfig_gen.cpp.in
|
static const QDateTime &getEol(); // defined in buildconfig_gen.cpp.in
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,23 @@ namespace BlackMisc
|
|||||||
return pDir;
|
return pDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CDirectoryUtils::executableFilePath(const QString &executable)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(!executable.isEmpty(), Q_FUNC_INFO, "Missing executable file path");
|
||||||
|
Q_ASSERT_X(CBuildConfig::isKnownExecutableName(executable), Q_FUNC_INFO, "Unknown exectuable");
|
||||||
|
|
||||||
|
QString s = CFileUtils::appendFilePaths(CDirectoryUtils::binDirectory(), executable);
|
||||||
|
if (CBuildConfig::isRunningOnMacOSXPlatform() && CDirectoryUtils::isMacOSXAppBundle())
|
||||||
|
{
|
||||||
|
s += QLatin1String(".app/Contents/MacOS/") + executable;
|
||||||
|
}
|
||||||
|
else if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||||
|
{
|
||||||
|
s += QLatin1String(".exe");
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
QString normalizedApplicationDirectoryImpl()
|
QString normalizedApplicationDirectoryImpl()
|
||||||
{
|
{
|
||||||
QString appDir = CDirectoryUtils::binDirectory();
|
QString appDir = CDirectoryUtils::binDirectory();
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ namespace BlackMisc
|
|||||||
//! Plugins directory
|
//! Plugins directory
|
||||||
static const QString &pluginsDirectory();
|
static const QString &pluginsDirectory();
|
||||||
|
|
||||||
|
//! The executable file path
|
||||||
|
static QString executableFilePath(const QString &executable);
|
||||||
|
|
||||||
//! swift application data directory, contains 0..n swift installation directories
|
//! swift application data directory, contains 0..n swift installation directories
|
||||||
static const QString &applicationDataDirectory();
|
static const QString &applicationDataDirectory();
|
||||||
|
|
||||||
|
|||||||
@@ -265,13 +265,7 @@ void CSwiftLauncher::startSwiftCore()
|
|||||||
// I set this for debug purpose only
|
// I set this for debug purpose only
|
||||||
m_executableArgs = args;
|
m_executableArgs = args;
|
||||||
m_executable.clear();
|
m_executable.clear();
|
||||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::binDirectory(), CBuildConfig::swiftCoreExecutableName());
|
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftCoreExecutableName());
|
||||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
|
||||||
{
|
|
||||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
|
||||||
m_executable += CBuildConfig::swiftCoreExecutableName();
|
|
||||||
}
|
|
||||||
|
|
||||||
CLogMessage(this).info(this->getCmdLine());
|
CLogMessage(this).info(this->getCmdLine());
|
||||||
|
|
||||||
// start
|
// start
|
||||||
@@ -281,24 +275,14 @@ void CSwiftLauncher::startSwiftCore()
|
|||||||
void CSwiftLauncher::setSwiftDataExecutable()
|
void CSwiftLauncher::setSwiftDataExecutable()
|
||||||
{
|
{
|
||||||
m_executable.clear();
|
m_executable.clear();
|
||||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::binDirectory(), CBuildConfig::swiftDataExecutableName());
|
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftDataExecutableName());
|
||||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
|
||||||
{
|
|
||||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
|
||||||
m_executable += CBuildConfig::swiftDataExecutableName();
|
|
||||||
}
|
|
||||||
m_executableArgs.clear();
|
m_executableArgs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSwiftLauncher::setSwiftGuiExecutable()
|
bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||||
{
|
{
|
||||||
m_executable.clear();
|
m_executable.clear();
|
||||||
m_executable = CFileUtils::appendFilePaths(CDirectoryUtils::binDirectory(), CBuildConfig::swiftGuiExecutableName());
|
m_executable = CDirectoryUtils::executableFilePath(CBuildConfig::swiftGuiExecutableName());
|
||||||
if (CBuildConfig::isRunningOnMacOSXPlatform())
|
|
||||||
{
|
|
||||||
m_executable += QLatin1String(".app/Contents/MacOS/");
|
|
||||||
m_executable += CBuildConfig::swiftGuiExecutableName();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList args
|
QStringList args
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user