mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-12 20:55:39 +08:00
Ref T103, unified isMacOSXBundle
This commit is contained in:
committed by
Mathew Sutcliffe
parent
caf358401f
commit
d25be35868
@@ -51,7 +51,7 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(CBuildConfig::isKnownExecutableName(executable), Q_FUNC_INFO, "Unknown exectuable");
|
||||
|
||||
QString s = CFileUtils::appendFilePaths(CDirectoryUtils::binDirectory(), executable);
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform() && CDirectoryUtils::isMacOSXAppBundle())
|
||||
if (CDirectoryUtils::isMacOSXAppBundle())
|
||||
{
|
||||
s += QLatin1String(".app/Contents/MacOS/") + executable;
|
||||
}
|
||||
@@ -123,25 +123,19 @@ namespace BlackMisc
|
||||
return p;
|
||||
}
|
||||
|
||||
bool isAppBundleImpl()
|
||||
{
|
||||
QDir bundleDir(CDirectoryUtils::binDirectory());
|
||||
bundleDir.cd("../..");
|
||||
const bool isBundled = QFileInfo(bundleDir.absolutePath()).isBundle();
|
||||
return isBundled;
|
||||
}
|
||||
|
||||
QString getSwiftShareDirImpl()
|
||||
{
|
||||
QDir dir(CDirectoryUtils::binDirectory());
|
||||
bool success = true;
|
||||
|
||||
static const bool appBundle = isAppBundleImpl();
|
||||
if (CBuildConfig::isRunningOnMacOSXPlatform() && appBundle)
|
||||
if (CDirectoryUtils::isMacOSXAppBundle())
|
||||
{
|
||||
success = dir.cd("../../../../share");
|
||||
}
|
||||
else { success = dir.cd("../share"); }
|
||||
else
|
||||
{
|
||||
success = dir.cd("../share");
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user