diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1996-11-09 18:45:18 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1996-11-09 18:45:18 (GMT) |
commit | 26ee1260a20dba4ed89165e187c8db74b8de82a8 (patch) | |
tree | a49f5d0727018fd628e5f679628d549fbc2f2fae /Mac/Python/macgetpath.c | |
parent | 8096daad4f835fbb8261ebd4dddc61b53cc93779 (diff) | |
download | cpython-26ee1260a20dba4ed89165e187c8db74b8de82a8.zip cpython-26ee1260a20dba4ed89165e187c8db74b8de82a8.tar.gz cpython-26ee1260a20dba4ed89165e187c8db74b8de82a8.tar.bz2 |
Got rid of nfullpath in favor of PyMac_GetFullPath (which was pretty
much identical anyway).
Initialize PyMac_ApplicationPath and PyMac_ApplicationFSSpec to point
to the current application.
Diffstat (limited to 'Mac/Python/macgetpath.c')
-rw-r--r-- | Mac/Python/macgetpath.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c index a7c1366..11eea57 100644 --- a/Mac/Python/macgetpath.c +++ b/Mac/Python/macgetpath.c @@ -147,10 +147,11 @@ PyMac_OpenPrefFile() printf("Cannot create preferences file, error %d\n", ResError()); exit(1); } - if ( (err=PyMac_process_location(&dirspec)) != 0 ) { - printf("Cannot get FSSpec for application, error %d\n", err); + if ( (err=PyMac_init_process_location()) != 0 ) { + printf("Cannot get application location, error %d\n", err); exit(1); } + dirspec = PyMac_ApplicationFSSpec; dirspec.name[0] = 0; if ((err=NewAlias(NULL, &dirspec, &handle)) != 0 ) { printf("Cannot make alias to application directory, error %d\n", err); @@ -212,7 +213,7 @@ PyMac_GetPythonDir() if ( prefrh != -1 ) CloseResFile(prefrh); UseResFile(oldrh); - if ( nfullpath(&dirspec, name) == 0 ) { + if ( PyMac_GetFullPath(&dirspec, name) == 0 ) { strcat(name, ":"); } else { /* If all fails, we return the current directory */ @@ -228,7 +229,6 @@ PyMac_GetPythonDir() static char * PyMac_GetPythonPath() { - FSSpec dirspec; short oldrh, prefrh = -1; char *rv; int i, newlen; @@ -289,20 +289,16 @@ PyMac_GetPythonPath() rv[newlen-1] = 0; } else if ( pathitem[0] >= 14 && strncmp((char *)pathitem+1, "$(APPLICATION)", 14) == 0 ) { /* This is the application itself */ - char fullname[256]; - if ( (err=PyMac_process_location(&dirspec)) != 0 ) { - printf("Cannot get FSSpec for application, error %d\n", err); - exit(1); - } - if ( nfullpath(&dirspec, fullname) != 0 ) { - printf("Cannot convert application fsspec to path\n"); + if ( (err=PyMac_init_process_location()) != 0 ) { + printf("Cannot get application location, error %d\n", err); exit(1); } - newlen = strlen(rv) + strlen(fullname) + 2; + + newlen = strlen(rv) + strlen(PyMac_ApplicationPath) + 2; if( (rv=realloc(rv, newlen)) == NULL) goto out; - strcpy(rv+strlen(rv), fullname); + strcpy(rv+strlen(rv), PyMac_ApplicationPath); rv[newlen-2] = '\n'; rv[newlen-1] = 0; |