mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 15:34:58 +00:00 
			
		
		
		
	reworked GetBasePath on OS X to use Contents/Resource by default if bundled, or exedir if not bundled.
- also adds OS X specific magic for bundled apps adding an Info.plist property of name SDL_FILESYSTEM_BASE_DIR_TYPE to the following values will change the bahaviour. * bundle -- use the bundle directory e.g. "/Applications/MyGame/Blah.app/" * parent -- use the bundle parent directory e.g. "/Applications/MyGame/" * resource -- use the bundle resource directory (default) e.g. "/Applications/MyGame/Blah.app/Contents/Resources/"
This commit is contained in:
		
							parent
							
								
									9ce449e6cd
								
							
						
					
					
						commit
						833fd30eb8
					
				| 
						 | 
				
			
			@ -37,8 +37,21 @@ char *
 | 
			
		|||
SDL_GetBasePath(void)
 | 
			
		||||
{
 | 
			
		||||
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 | 
			
		||||
    const char *base = [[[NSBundle mainBundle] bundlePath] UTF8String];
 | 
			
		||||
    NSBundle *bundle = [NSBundle mainBundle];
 | 
			
		||||
    const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String];
 | 
			
		||||
    const char *base = NULL;
 | 
			
		||||
    char *retval = NULL;
 | 
			
		||||
    if (baseType == NULL) {
 | 
			
		||||
        baseType = "resource";
 | 
			
		||||
    }
 | 
			
		||||
    if (SDL_strcasecmp(baseType, "bundle")==0) {
 | 
			
		||||
        base = [[bundle bundlePath] UTF8String];
 | 
			
		||||
    } else if (SDL_strcasecmp(baseType, "parent")==0) {
 | 
			
		||||
        base = [[[bundle bundlePath] stringByDeletingLastPathComponent] UTF8String];
 | 
			
		||||
    } else {
 | 
			
		||||
        /* this returns the exedir for non-bundled  and the resourceDir for bundled apps */
 | 
			
		||||
        base = [[bundle resourcePath] UTF8String];
 | 
			
		||||
    }
 | 
			
		||||
    if (base) {
 | 
			
		||||
        const size_t len = SDL_strlen(base) + 2;
 | 
			
		||||
        retval = (char *) SDL_malloc(len);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue