mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-17 14:47:19 +01:00
Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation]
C.W. Betts The recommended way of getting a file name that POSIX file APIs can open in OS X when using an NSString is -[NSString fileSystemRepresentation]. However, the current filesystem API in hg uses -[NSString UTF8String].
This commit is contained in:
parent
360c3d853a
commit
deb8086b08
@ -45,12 +45,12 @@ SDL_GetBasePath(void)
|
|||||||
baseType = "resource";
|
baseType = "resource";
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(baseType, "bundle")==0) {
|
if (SDL_strcasecmp(baseType, "bundle")==0) {
|
||||||
base = [[bundle bundlePath] UTF8String];
|
base = [[bundle bundlePath] fileSystemRepresentation];
|
||||||
} else if (SDL_strcasecmp(baseType, "parent")==0) {
|
} else if (SDL_strcasecmp(baseType, "parent")==0) {
|
||||||
base = [[[bundle bundlePath] stringByDeletingLastPathComponent] UTF8String];
|
base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
|
||||||
} else {
|
} else {
|
||||||
/* this returns the exedir for non-bundled and the resourceDir for bundled apps */
|
/* this returns the exedir for non-bundled and the resourceDir for bundled apps */
|
||||||
base = [[bundle resourcePath] UTF8String];
|
base = [[bundle resourcePath] fileSystemRepresentation];
|
||||||
}
|
}
|
||||||
if (base) {
|
if (base) {
|
||||||
const size_t len = SDL_strlen(base) + 2;
|
const size_t len = SDL_strlen(base) + 2;
|
||||||
@ -77,7 +77,7 @@ SDL_GetPrefPath(const char *org, const char *app)
|
|||||||
|
|
||||||
if ([array count] > 0) { /* we only want the first item in the list. */
|
if ([array count] > 0) { /* we only want the first item in the list. */
|
||||||
NSString *str = [array objectAtIndex:0];
|
NSString *str = [array objectAtIndex:0];
|
||||||
const char *base = [str UTF8String];
|
const char *base = [str fileSystemRepresentation];
|
||||||
if (base) {
|
if (base) {
|
||||||
const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
|
const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
|
||||||
retval = (char *) SDL_malloc(len);
|
retval = (char *) SDL_malloc(len);
|
||||||
|
Loading…
Reference in New Issue
Block a user