Skip to content

Commit

Permalink
Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSyst…
Browse files Browse the repository at this point in the history
…emRepresentation]

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].
  • Loading branch information
slouken committed Oct 21, 2013
1 parent 360c3d8 commit deb8086
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/filesystem/cocoa/SDL_sysfilesystem.m
Expand Up @@ -45,12 +45,12 @@
baseType = "resource";
}
if (SDL_strcasecmp(baseType, "bundle")==0) {
base = [[bundle bundlePath] UTF8String];
base = [[bundle bundlePath] fileSystemRepresentation];
} else if (SDL_strcasecmp(baseType, "parent")==0) {
base = [[[bundle bundlePath] stringByDeletingLastPathComponent] UTF8String];
base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
} else {
/* this returns the exedir for non-bundled and the resourceDir for bundled apps */
base = [[bundle resourcePath] UTF8String];
base = [[bundle resourcePath] fileSystemRepresentation];
}
if (base) {
const size_t len = SDL_strlen(base) + 2;
Expand All @@ -77,7 +77,7 @@

if ([array count] > 0) { /* we only want the first item in the list. */
NSString *str = [array objectAtIndex:0];
const char *base = [str UTF8String];
const char *base = [str fileSystemRepresentation];
if (base) {
const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
Expand Down

0 comments on commit deb8086

Please sign in to comment.