c++ - Why doesn't the relative path work? -
i trying sdl project in xcode 4.6. followed instructions @ here , went fine. ran test code there.
now when try load bmp
sdl_surface* bmp = sdl_loadbmp("cb.bmp"); it says unable load bmp. if use absoulte path, works fine.
what problem? should use relative path?
the folder structure follows:
sdl_test sdl_test.xcodeproj sdl_test cb.bmp sdlmain.m sdlmain.h main.cpp sdl_test.1
i have had exact same problem when started out xcode.
you have change working directoy in sdlmain.m file. find setupworkingdirectory method, , replace this:
/* set working directory .app's parent directory */ - (void) setupworkingdirectory:(bool)shouldchdir { //setting working directoy myapp.app/contents/resources/ nsstring *resourcepath = [[nsbundle mainbundle] resourcepath]; [[nsfilemanager defaultmanager] changecurrentdirectorypath:resourcepath]; } hope works.
Comments
Post a Comment