@@ -54,10 +54,16 @@ typedef unsigned long refcontype;
5454#include "Python.h"
5555#include "macglue.h"
5656
57+ #ifdef TARGET_API_MAC_OSX
58+ #define PATHNAMELEN 1024
59+ #else
60+ #define PATHNAMELEN 256
61+ #endif
62+
5763static int arg_count ;
5864static char * arg_vector [256 ];
5965FSSpec PyMac_ApplicationFSSpec ;
60- char PyMac_ApplicationPath [256 ];
66+ char PyMac_ApplicationPath [PATHNAMELEN ];
6167
6268/* Duplicate a string to the heap. We also export this since it isn't standard
6369** and others use it
@@ -73,22 +79,6 @@ strdup(const char *src)
7379}
7480#endif
7581
76- #if TARGET_API_MAC_OSX
77- OSErr
78- PyMac_GetFullPath (FSSpec * fss , char * path )
79- {
80- FSRef fsr ;
81- OSErr err ;
82-
83- * path = '\0' ;
84- err = FSpMakeFSRef (fss , & fsr );
85- if ( err ) return err ;
86- err = (OSErr )FSRefMakePath (& fsr , path , 1024 );
87- if ( err ) return err ;
88- return 0 ;
89- }
90- #endif /* TARGET_API_MAC_OSX */
91-
9282
9383#if !TARGET_API_MAC_OSX
9484/* Initialize FSSpec and full name of current application */
@@ -109,7 +99,7 @@ PyMac_init_process_location(void)
10999 info .processAppSpec = & PyMac_ApplicationFSSpec ;
110100 if ( err = GetProcessInformation (& currentPSN , & info ))
111101 return err ;
112- if ( err = PyMac_GetFullPath (& PyMac_ApplicationFSSpec , PyMac_ApplicationPath ) )
102+ if ( err = PyMac_GetFullPathname (& PyMac_ApplicationFSSpec , PyMac_ApplicationPath , PATHNAMELEN ) )
113103 return err ;
114104 applocation_inited = 1 ;
115105 return 0 ;
@@ -170,7 +160,7 @@ handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype r
170160 DescType rttype ;
171161 long i , ndocs , size ;
172162 FSSpec fss ;
173- char path [1024 ];
163+ char path [PATHNAMELEN ];
174164
175165 got_one = 1 ;
176166 if ((err = AEGetParamDesc (theAppleEvent ,
@@ -185,7 +175,7 @@ handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype r
185175 & keywd , & rttype , & fss , sizeof (fss ), & size );
186176 if (err )
187177 break ;
188- PyMac_GetFullPath (& fss , path );
178+ PyMac_GetFullPathname (& fss , path , PATHNAMELEN );
189179 arg_vector [arg_count ++ ] = strdup (path );
190180 }
191181 return err ;
0 commit comments