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

Jack Jansen jackjansen@users.sourceforge.net
2001年8月03日 08:39:29 -0700


Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv20528/Modules
Modified Files:
	macfsmodule.c 
Log Message:
PyMac_GetFSSpec must be called via the dylib glue code on OSX.
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** macfsmodule.c	2001年08月03日 13:31:36	1.38
--- macfsmodule.c	2001年08月03日 15:39:27	1.39
***************
*** 25,28 ****
--- 25,29 ----
 #include "Python.h"
 #include "macglue.h"
+ #include "pymactoolbox.h"
 
 #ifdef WITHOUT_FRAMEWORKS
***************
*** 38,43 ****
 
 #include "getapplbycreator.h"
- 
 
 static PyObject *ErrorObject;
 
--- 39,47 ----
 
 #include "getapplbycreator.h"
 
+ #ifdef USE_TOOLBOX_OBJECT_GLUE
+ extern int _PyMac_GetFSSpec(PyObject *, FSSpec *);
+ #define PyMac_GetFSSpec _PyMac_GetFSSpec
+ #endif
 static PyObject *ErrorObject;
 
***************
*** 1202,1207 ****
--- 1206,1220 ----
 		return 1;
 	if ( PyString_Check(v) ) {
+ #if TARGET_API_MAC_OSX
+ 		OSStatus err;
+ 		if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) {
+ 			PyErr_Mac(ErrorObject, err);
+ 			return 0;
+ 		}
+ 		return 1;
+ #else
 		PyErr_SetString(PyExc_NotImplementedError, "Cannot create an FSRef from a pathname on this platform");
 		return 0;
+ #endif
 	}
 	PyErr_SetString(PyExc_TypeError, "FSRef argument should be existing FSRef, FSSpec or (OSX only) pathname");
***************
*** 1270,1273 ****
--- 1283,1288 ----
 {
 	PyObject *m, *d;
+ 
+ 		PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, PyMac_GetFSSpec);
 
 	/* Create the module and add the functions */

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