Fixes for macOS game building
This commit is contained in:
@@ -360,7 +360,7 @@ String MacPlatform::GetMainDirectory()
|
||||
if (path.EndsWith(TEXT("/Contents/MacOS")))
|
||||
{
|
||||
// If running from executable in a package, go up to the Contents
|
||||
path = StringUtils::GetDirectoryName(path);
|
||||
path = path.Left(path.Length() - 6);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -278,11 +278,18 @@ bool MCore::LoadEngine()
|
||||
CallStaticMethodByName<void>(TEXT("Init"));
|
||||
#ifdef MCORE_MAIN_MODULE_NAME
|
||||
// MCORE_MAIN_MODULE_NAME define is injected by Scripting.Build.cs on platforms that use separate shared library for engine symbols
|
||||
const StringAnsi flaxLibraryPath(Platform::GetMainDirectory() / TEXT(MACRO_TO_STR(MCORE_MAIN_MODULE_NAME)));
|
||||
::String flaxLibraryPath(Platform::GetMainDirectory() / TEXT(MACRO_TO_STR(MCORE_MAIN_MODULE_NAME)));
|
||||
#else
|
||||
const StringAnsi flaxLibraryPath(Platform::GetExecutableFilePath());
|
||||
::String flaxLibraryPath(Platform::GetExecutableFilePath());
|
||||
#endif
|
||||
RegisterNativeLibrary("FlaxEngine", flaxLibraryPath.Get());
|
||||
#if PLATFORM_MAC
|
||||
// On some platforms all native binaries are side-by-side with the app in a different folder
|
||||
if (!FileSystem::FileExists(flaxLibraryPath))
|
||||
{
|
||||
flaxLibraryPath = ::String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(flaxLibraryPath);
|
||||
}
|
||||
#endif
|
||||
RegisterNativeLibrary("FlaxEngine", StringAnsi(flaxLibraryPath).Get());
|
||||
|
||||
MRootDomain = New<MDomain>("Root");
|
||||
MDomains.Add(MRootDomain);
|
||||
|
||||
@@ -345,9 +345,12 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
|
||||
{
|
||||
// Load library
|
||||
const auto startTime = DateTime::NowUTC();
|
||||
#if PLATFORM_ANDROID
|
||||
// On Android all native binaries are side-by-side with the app
|
||||
nativePath = String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(nativePath);
|
||||
#if PLATFORM_ANDROID || PLATFORM_MAC
|
||||
// On some platforms all native binaries are side-by-side with the app in a different folder
|
||||
if (!FileSystem::FileExists(nativePath))
|
||||
{
|
||||
nativePath = String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(nativePath);
|
||||
}
|
||||
#endif
|
||||
auto library = Platform::LoadLibrary(nativePath.Get());
|
||||
if (!library)
|
||||
|
||||
Reference in New Issue
Block a user