| Summary: | SDLMain.m in OSX 10.9 fails to set working directory | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Jason Rohrer <jasonrohrer> |
| Component: | main | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | 1.2.15 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
|
Description
Jason Rohrer
2013-11-15 23:32:06 UTC
I'll fix this tonight. --ryan. (In reply to Jason Rohrer from comment #0) > Also, I looked at the 2.0.1 source, and I don't see this handled anywhere in > there... so are you you just leaving the "/" set as the cwd on Mac in 2.0.1? This was sort of an accidental quirk of SDL 1.2 on the Mac; no other platform changed the working directory (as far I as recall), so when we got rid of SDLmain for SDL2, this functionality went away with it. That being said, in SDL 2.0.1, you can do this at the start of your own main()... chdir(SDL_GetBasePath()); // with error checking, of course. ...which should work consistently on all platforms to figure out where your app is running. Be sure to read the Remarks section on this, though, since you can tweak what one considers the "base" directory on Mac OS X... https://wiki.libsdl.org/SDL_GetBasePath --ryan.
This issue in SDL 1.2 is now fixed here:
https://hg.libsdl.org/SDL/rev/cfec3f86fba7
Unfortunately, being part of SDLmain, you'll need to recompile your app with the updated SDLmain.m (or the static library containing it) to pick up the fix, instead of just dropping in a new SDL.
This would be a good time to recommend you move to SDL2! :) If you want to do that at some point, and want help with that, drop me an email: icculus@icculus.org
--ryan.
|