Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
19555aa5
Commit
19555aa5
authored
Sep 14, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mac-specific mod to enable aliases on import paths.
(Jack Jansen and/or Just van Rossum)
parent
20c393fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
9 deletions
+35
-9
Python/import.c
Python/import.c
+26
-9
Python/importdl.c
Python/importdl.c
+9
-0
No files found.
Python/import.c
View file @
19555aa5
...
@@ -1055,16 +1055,33 @@ check_case(char *buf, int len, int namelen, char *name)
...
@@ -1055,16 +1055,33 @@ check_case(char *buf, int len, int namelen, char *name)
#ifdef macintosh
#ifdef macintosh
#include <TextUtils.h>
#include <TextUtils.h>
#ifdef USE_GUSI
#include "TFileSpec.h"
/* for Path2FSSpec() */
#endif
static
int
static
int
check_case
(
char
*
buf
,
int
len
,
int
namelen
,
char
*
name
)
check_case
(
char
*
buf
,
int
len
,
int
namelen
,
char
*
name
)
{
{
FSSpec
fss
;
FSSpec
fss
;
OSErr
err
;
OSErr
err
;
unsigned
char
mybuf
[
MAXPATHLEN
+
1
];
#ifndef USE_GUSI
err
=
FSMakeFSSpec
(
0
,
0
,
Pstring
(
buf
),
&
fss
);
strcpy
((
char
*
)
mybuf
,
buf
);
#else
c2pstr
((
char
*
)
mybuf
);
/* GUSI's Path2FSSpec() resolves all possible aliases nicely on
err
=
FSMakeFSSpec
(
0
,
0
,
mybuf
,
&
fss
);
the way, which is fine for all directories, but here we need
the original name of the alias file (say, Dlg.ppc.slb, not
toolboxmodules.ppc.slb). */
char
*
colon
;
err
=
Path2FSSpec
(
buf
,
&
fss
);
if
(
err
==
noErr
)
{
colon
=
strrchr
(
buf
,
':'
);
/* find filename */
if
(
colon
!=
NULL
)
err
=
FSMakeFSSpec
(
fss
.
vRefNum
,
fss
.
parID
,
Pstring
(
colon
+
1
),
&
fss
);
else
err
=
FSMakeFSSpec
(
fss
.
vRefNum
,
fss
.
parID
,
fss
.
name
,
&
fss
);
}
#endif
if
(
err
)
{
if
(
err
)
{
PyErr_Format
(
PyExc_NameError
,
PyErr_Format
(
PyExc_NameError
,
"Can't find file for module %.100s
\n
(filename %.300s)"
,
"Can't find file for module %.100s
\n
(filename %.300s)"
,
...
...
Python/importdl.c
View file @
19555aa5
...
@@ -249,6 +249,9 @@ typedef void (*dl_funcptr)();
...
@@ -249,6 +249,9 @@ typedef void (*dl_funcptr)();
#define CFragConnectionID ConnectionID
#define CFragConnectionID ConnectionID
#define kLoadCFrag 0x01
#define kLoadCFrag 0x01
#endif
#endif
#ifdef USE_GUSI
#include "TFileSpec.h"
/* for Path2FSSpec() */
#endif
#include <Files.h>
#include <Files.h>
#include "macdefs.h"
#include "macdefs.h"
#include "macglue.h"
#include "macglue.h"
...
@@ -372,15 +375,21 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
...
@@ -372,15 +375,21 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
Ptr
mainAddr
;
Ptr
mainAddr
;
Str255
errMessage
;
Str255
errMessage
;
OSErr
err
;
OSErr
err
;
#ifndef USE_GUSI
Boolean
isfolder
,
didsomething
;
Boolean
isfolder
,
didsomething
;
#endif
char
buf
[
512
];
char
buf
[
512
];
Str63
fragname
;
Str63
fragname
;
Ptr
symAddr
;
Ptr
symAddr
;
CFragSymbolClass
class
;
CFragSymbolClass
class
;
/* First resolve any aliases to find the real file */
/* First resolve any aliases to find the real file */
#ifdef USE_GUSI
err
=
Path2FSSpec
(
pathname
,
&
libspec
);
#else
(
void
)
FSMakeFSSpec
(
0
,
0
,
Pstring
(
pathname
),
&
libspec
);
(
void
)
FSMakeFSSpec
(
0
,
0
,
Pstring
(
pathname
),
&
libspec
);
err
=
ResolveAliasFile
(
&
libspec
,
1
,
&
isfolder
,
&
didsomething
);
err
=
ResolveAliasFile
(
&
libspec
,
1
,
&
isfolder
,
&
didsomething
);
#endif
if
(
err
)
{
if
(
err
)
{
sprintf
(
buf
,
"%.255s: %.200s"
,
sprintf
(
buf
,
"%.255s: %.200s"
,
pathname
,
PyMac_StrError
(
err
));
pathname
,
PyMac_StrError
(
err
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment