MacOsX setupWorkingDirectory

Hello, how to modify

(void) setupWorkingDirectory:(BOOL)shouldChdir

into the sdl.m to make the working directory

program.app/Contents/Resources

(I want to put my data into the .app dirctory)------------------------
http://mandarx.xoom.it/index.php?lang=eng

  • (void) setupWorkingDirectory:(BOOL)shouldChdir
    {
    if (shouldChdir)
    {
    char workingdir[MAXPATHLEN];
    CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
    if (CFURLGetFileSystemRepresentation(url, true, (UInt8 *)workingdir,
    MAXPATHLEN)) {
    assert ( chdir (workingdir) == 0 );
    }
    CFRelease(url);
    }

}

You can download the file here –

http://www.noquarterarcade.com/system/files/SDLMain.m.zipOn Sun, Mar 7, 2010 at 7:59 AM, mandarx wrote:

Hello, how to modify

(void) setupWorkingDirectory:(BOOL)shouldChdir

into the sdl.m to make the working directory

program.app/Contents/Resources

(I want to put my data into the .app dirctory)


Todd Steinackle

Todd Steinackle wrote:

You can download the file here –

http://www.noquarterarcade.com/system/files/SDLMain.m.zip

thanks I knew it, but I didt’n undestand how that code works…

MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng

i haven’t tested this line, but i believe it should work

[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle

mainBundle] resourcePath]];

bye
VittorioOn Sun, Mar 7, 2010 at 1:59 PM, mandarx wrote:

Hello, how to modify

(void) setupWorkingDirectory:(BOOL)shouldChdir

into the sdl.m to make the working directory

program.app/Contents/Resources

(I want to put my data into the .app dirctory)


http://mandarx.xoom.it/index.php?lang=eng


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Vittorio G. wrote:

i haven’t tested this line, but i believe it should work

??? [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];

bye
Vittorio

thanks!------------------------
http://mandarx.xoom.it/index.php?lang=eng