src/video/cocoa_v.mm
changeset 6317 70f4e9e52eb1
parent 6289 9f468eccc674
child 6878 5cefd3ac59c7
equal deleted inserted replaced
6316:d2b70e10f106 6317:70f4e9e52eb1
  2045 	if (!wasstarted) CocoaVideoStop();
  2045 	if (!wasstarted) CocoaVideoStop();
  2046 
  2046 
  2047 	_cocoa_video_dialog = false;
  2047 	_cocoa_video_dialog = false;
  2048 }
  2048 }
  2049 
  2049 
  2050 
       
  2051 /* This is needed since OS X applications are started with the working dir set to / when double-clicked */
       
  2052 void cocoaSetWorkingDirectory()
       
  2053 {
       
  2054 	char parentdir[MAXPATHLEN];
       
  2055 	int chdir_ret;
       
  2056 	CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
       
  2057 	CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
       
  2058 	if (CFURLGetFileSystemRepresentation(url2, true, (unsigned char*)parentdir, MAXPATHLEN)) {
       
  2059 		chdir_ret = chdir(parentdir); /* chdir to the binary app's parent */
       
  2060 		assert(chdir_ret == 0);
       
  2061 	}
       
  2062 	CFRelease(url);
       
  2063 	CFRelease(url2);
       
  2064 }
       
  2065 
       
  2066 /* These are called from main() to prevent a _NSAutoreleaseNoPool error when
  2050 /* These are called from main() to prevent a _NSAutoreleaseNoPool error when
  2067  * exiting before the cocoa video driver has been loaded
  2051  * exiting before the cocoa video driver has been loaded
  2068  */
  2052  */
  2069 void cocoaSetupAutoreleasePool()
  2053 void cocoaSetupAutoreleasePool()
  2070 {
  2054 {