[Python-checkins] CVS: python/dist/src/Mac/Python macgetargv.c,1.25,1.26 macgetpath.c,1.23,1.24
Jack Jansen
jackjansen@users.sourceforge.net
Mon, 10 Sep 2001 15:00:41 -0700
Update of /cvsroot/python/python/dist/src/Mac/Python
In directory usw-pr-cvs1:/tmp/cvs-serv10457/Mac/Python
Modified Files:
macgetargv.c macgetpath.c
Log Message:
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
parameter for the return string (as unix pathnames are not limited
by the 255 char pstring limit).
Implemented the function for MachO-Python, where it returns unix pathnames.
Index: macgetargv.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetargv.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** macgetargv.c 2001/09/05 22:07:52 1.25
--- macgetargv.c 2001/09/10 22:00:39 1.26
***************
*** 55,62 ****
#include "macglue.h"
static int arg_count;
static char *arg_vector[256];
FSSpec PyMac_ApplicationFSSpec;
! char PyMac_ApplicationPath[256];
/* Duplicate a string to the heap. We also export this since it isn't standard
--- 55,68 ----
#include "macglue.h"
+ #ifdef TARGET_API_MAC_OSX
+ #define PATHNAMELEN 1024
+ #else
+ #define PATHNAMELEN 256
+ #endif
+
static int arg_count;
static char *arg_vector[256];
FSSpec PyMac_ApplicationFSSpec;
! char PyMac_ApplicationPath[PATHNAMELEN];
/* Duplicate a string to the heap. We also export this since it isn't standard
***************
*** 74,93 ****
#endif
- #if TARGET_API_MAC_OSX
- OSErr
- PyMac_GetFullPath(FSSpec *fss, char *path)
- {
- FSRef fsr;
- OSErr err;
-
- *path = '\0';
- err = FSpMakeFSRef(fss, &fsr);
- if ( err ) return err;
- err = (OSErr)FSRefMakePath(&fsr, path, 1024);
- if ( err ) return err;
- return 0;
- }
- #endif /* TARGET_API_MAC_OSX */
-
#if !TARGET_API_MAC_OSX
--- 80,83 ----
***************
*** 110,114 ****
if ( err=GetProcessInformation(¤tPSN, &info))
return err;
! if ( err=PyMac_GetFullPath(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath) )
return err;
applocation_inited = 1;
--- 100,104 ----
if ( err=GetProcessInformation(¤tPSN, &info))
return err;
! if ( err=PyMac_GetFullPathname(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath, PATHNAMELEN) )
return err;
applocation_inited = 1;
***************
*** 171,175 ****
long i, ndocs, size;
FSSpec fss;
! char path[1024];
got_one = 1;
--- 161,165 ----
long i, ndocs, size;
FSSpec fss;
! char path[PATHNAMELEN];
got_one = 1;
***************
*** 186,190 ****
if (err)
break;
! PyMac_GetFullPath(&fss, path);
arg_vector[arg_count++] = strdup(path);
}
--- 176,180 ----
if (err)
break;
! PyMac_GetFullPathname(&fss, path, PATHNAMELEN);
arg_vector[arg_count++] = strdup(path);
}
Index: macgetpath.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetpath.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** macgetpath.c 2000/07/14 22:16:01 1.23
--- macgetpath.c 2001/09/10 22:00:39 1.24
***************
*** 39,42 ****
--- 39,47 ----
#endif
+ #ifdef TARGET_API_MAC_OSX
+ #define PATHNAMELEN 1024
+ #else
+ #define PATHNAMELEN 256
+ #endif
/* Return the initial python search path. This is called once from
***************
*** 245,249 ****
{
static int diditbefore = 0;
! static char name[256] = {':', '\0'};
AliasHandle handle;
FSSpec dirspec;
--- 250,254 ----
{
static int diditbefore = 0;
! static char name[PATHNAMELEN] = {':', '\0'};
AliasHandle handle;
FSSpec dirspec;
***************
*** 286,290 ****
UseResFile(oldrh);
! if ( PyMac_GetFullPath(&dirspec, name) == 0 ) {
strcat(name, ":");
} else {
--- 291,295 ----
UseResFile(oldrh);
! if ( PyMac_GetFullPathname(&dirspec, name, PATHNAMELEN) == 0 ) {
strcat(name, ":");
} else {