comparison Mac/Python/macgetpath.c @ 22958:5f2dcdd09329 legacy-trunk

Got rid of ifdefs for long-obsolete GUSI versions and other stuff that is now standard (appearance, interned strings)
author Jack Jansen <jack.jansen@cwi.nl>
date Thu, 11 Apr 2002 20:48:25 +0000
parents 274aa91b417c
children 1598a1e473e2
comparison
equal deleted inserted replaced
22957:4f9d5ea4f37d 22958:5f2dcdd09329
60 #include <Aliases.h> 60 #include <Aliases.h>
61 #include <Folders.h> 61 #include <Folders.h>
62 #include <Resources.h> 62 #include <Resources.h>
63 #include <TextUtils.h> 63 #include <TextUtils.h>
64 #include <Dialogs.h> 64 #include <Dialogs.h>
65
66 #ifdef USE_GUSI1
67 #include <GUSI.h>
68 #endif
69 65
70 #ifndef USE_BUILTIN_PATH 66 #ifndef USE_BUILTIN_PATH
71 staticforward char *PyMac_GetPythonPath(); 67 staticforward char *PyMac_GetPythonPath();
72 #endif 68 #endif
73 69
209 205
210 if ( !getpreffilefss(&dirspec)) 206 if ( !getpreffilefss(&dirspec))
211 return -1; 207 return -1;
212 prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); 208 prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm);
213 if ( prefrh < 0 ) { 209 if ( prefrh < 0 ) {
214 #if 0
215 action = CautionAlert(NOPREFFILE_ID, NULL);
216 if ( action == NOPREFFILE_NO )
217 exit(1);
218 #endif
219 FSpCreateResFile(&dirspec, 'Pyth', 'pref', 0); 210 FSpCreateResFile(&dirspec, 'Pyth', 'pref', 0);
220 prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); 211 prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm);
221 if ( prefrh == -1 ) { 212 if ( prefrh == -1 ) {
222 /* This "cannot happen":-) */ 213 /* This "cannot happen":-) */
223 printf("Cannot create preferences file, error %d\n", ResError()); 214 printf("Cannot create preferences file, error %d\n", ResError());
451 HUnlock(handle); 442 HUnlock(handle);
452 443
453 if ( prefrh != -1) CloseResFile(prefrh); 444 if ( prefrh != -1) CloseResFile(prefrh);
454 UseResFile(oldrh); 445 UseResFile(oldrh);
455 } 446 }
456
457 #ifdef USE_GUSI1
458 void
459 PyMac_SetGUSIOptions()
460 {
461 Handle h;
462 short oldrh, prefrh = -1;
463
464 oldrh = CurResFile();
465
466 /* Try override from the application resource fork */
467 UseResFile(PyMac_AppRefNum);
468 h = Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID);
469 UseResFile(oldrh);
470
471 /* If that didn't work try nonoverride from anywhere */
472 if ( h == NULL ) {
473 prefrh = PyMac_OpenPrefFile();
474 h = GetResource('GU\267I', GUSIOPTIONS_ID);
475 }
476 if ( h ) GUSILoadConfiguration(h);
477 if ( prefrh != -1) CloseResFile(prefrh);
478 UseResFile(oldrh);
479 }
480 #endif /* USE_GUSI1 */