mirror of
https://github.com/minetest/irrlicht.git
synced 2025-01-12 10:50:31 +01:00
Gracefully handle lack of bundle on macOS
should fix https://github.com/minetest/minetest/issues/10170
This commit is contained in:
parent
7d1dc8b2d5
commit
fa2a7dc236
@ -553,7 +553,6 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||||||
IsActive(true), IsFullscreen(false), IsShiftDown(false), IsControlDown(false), IsResizable(false)
|
IsActive(true), IsFullscreen(false), IsShiftDown(false), IsControlDown(false), IsResizable(false)
|
||||||
{
|
{
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
NSString *path;
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CIrrDeviceMacOSX");
|
setDebugName("CIrrDeviceMacOSX");
|
||||||
@ -572,6 +571,8 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||||||
// Create menu
|
// Create menu
|
||||||
|
|
||||||
NSString* bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
|
NSString* bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
|
||||||
|
if (bundleName == nil)
|
||||||
|
bundleName = @"Irrlicht";
|
||||||
|
|
||||||
NSMenu* mainMenu = [[[NSMenu alloc] initWithTitle:@"MainMenu"] autorelease];
|
NSMenu* mainMenu = [[[NSMenu alloc] initWithTitle:@"MainMenu"] autorelease];
|
||||||
NSMenu* menu = [[[NSMenu alloc] initWithTitle:bundleName] autorelease];
|
NSMenu* menu = [[[NSMenu alloc] initWithTitle:bundleName] autorelease];
|
||||||
@ -585,11 +586,13 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||||||
[NSApp finishLaunching];
|
[NSApp finishLaunching];
|
||||||
}
|
}
|
||||||
|
|
||||||
path = [[NSBundle mainBundle] bundlePath];
|
NSString *path = [[NSBundle mainBundle] bundlePath];
|
||||||
|
if (path != nil) {
|
||||||
path = [path stringByAppendingString:@"/Contents/Resources"];
|
path = [path stringByAppendingString:@"/Contents/Resources"];
|
||||||
chdir([path fileSystemRepresentation]);
|
chdir([path fileSystemRepresentation]);
|
||||||
[path release];
|
[path release];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uname(&name);
|
uname(&name);
|
||||||
Operator = new COSOperator(name.version);
|
Operator = new COSOperator(name.version);
|
||||||
|
Loading…
Reference in New Issue
Block a user