Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macgetpath.c @ 4523:4d0681f7cf6b legacy-trunk
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.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Sat, 09 Nov 1996 18:45:18 +0000 |
| parents | 0549e3428d57 |
| children | d6b292a33cfe |
line wrap: on
line diff
--- a/Mac/Python/macgetpath.c Sat Nov 09 18:43:44 1996 +0000 +++ b/Mac/Python/macgetpath.c Sat Nov 09 18:45:18 1996 +0000 @@ -147,10 +147,11 @@ 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 @@ 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 @@ static char * PyMac_GetPythonPath() { - FSSpec dirspec; short oldrh, prefrh = -1; char *rv; int i, newlen; @@ -289,20 +289,16 @@ 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); + if ( (err=PyMac_init_process_location()) != 0 ) { + printf("Cannot get application location, error %d\n", err); exit(1); } - if ( nfullpath(&dirspec, fullname) != 0 ) { - printf("Cannot convert application fsspec to path\n"); - 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;
