[Python-checkins] CVS: python/dist/src/Mac/Modules macfsmodule.c,1.45,1.46

Just van Rossum jvr@users.sourceforge.net
2001年10月31日 14:55:10 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv23790
Modified Files:
	macfsmodule.c 
Log Message:
Moved macfsn hackery from macmain.c to macfsmodule.c so it loads
on demand instead of at startup.
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** macfsmodule.c	2001年09月10日 22:00:39	1.45
--- macfsmodule.c	2001年10月31日 22:55:08	1.46
***************
*** 40,43 ****
--- 40,46 ----
 #include "getapplbycreator.h"
 
+ #include "pythonresources.h"
+ extern PyMac_PrefRecord PyMac_options;
+ 
 #ifdef USE_TOOLBOX_OBJECT_GLUE
 extern int _PyMac_GetFSSpec(PyObject *, FSSpec *);
***************
*** 1207,1210 ****
--- 1210,1240 ----
 }
 
+ 
+ /*
+ ** Import the macfsn module, which will override the Standard File
+ ** calls in the macfs builtin module by Navigation Services versions,
+ ** if available on this machine.
+ */
+ static void
+ PyMac_InstallNavServicesForSF(void)
+ {
+ 	if ( !PyMac_options.nonavservice ) {
+ 		PyObject *m = PyImport_ImportModule("macfsn");
+ 		
+ 		if ( m == NULL ) {
+ 			PySys_WriteStderr("'import macfsn' failed; ");
+ 			if (Py_VerboseFlag) {
+ 				PySys_WriteStderr("traceback:\n");
+ 				PyErr_Print();
+ 			}
+ 			else {
+ 				PySys_WriteStderr("use -v for traceback\n");
+ 			}
+ 			PyErr_Clear();
+ 		}
+ 	}
+ }
+ 
+ 
 /* Initialization function for the module (*must* be called initmacfs) */
 
***************
*** 1236,1239 ****
 	Py_INCREF(&Mfsitype);
 	PyDict_SetItemString(d, "FInfoType", (PyObject *)&Mfsitype);
! 	/* XXXX Add constants here */
 }
--- 1266,1270 ----
 	Py_INCREF(&Mfsitype);
 	PyDict_SetItemString(d, "FInfoType", (PyObject *)&Mfsitype);
! 
! 	PyMac_InstallNavServicesForSF();
 }

AltStyle によって変換されたページ (->オリジナル) /