참고: http://ko.w3support.net/index.php?db=so&id=516200
#include <CoreFoundation/CoreFoundation.h>
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourceURL, TRUE, (Uint8 *)path, PATH_MAX)) {
	// error
	printf("error");
}
CFRelease(resourceURL);
chdir(path);
printf("current path:=%s\n", path);
플랫폼이 mac 인지 확인하려면 __APPLE__ 이 define 되었는지 확인한다.
#ifdef __APPLE__ ... #endif
 
댓글 없음:
댓글 쓰기