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
741e0378
Commit
741e0378
authored
May 19, 2001
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved PyMac_GetFullPath from macgetargv.c to macglue.c. It should
have been there in the first place.
parent
f3163303
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
40 deletions
+60
-40
Mac/Python/macgetargv.c
Mac/Python/macgetargv.c
+0
-40
Mac/Python/macglue.c
Mac/Python/macglue.c
+60
-0
No files found.
Mac/Python/macgetargv.c
View file @
741e0378
...
...
@@ -108,46 +108,6 @@ get_folder_parent (FSSpec * fss, FSSpec * parent)
return
0
;
}
/* Given an FSSpec return a full, colon-separated pathname */
OSErr
PyMac_GetFullPath
(
FSSpec
*
fss
,
char
*
buf
)
{
short
err
;
FSSpec
fss_parent
,
fss_current
;
char
tmpbuf
[
1024
];
int
plen
;
fss_current
=
*
fss
;
plen
=
fss_current
.
name
[
0
];
memcpy
(
buf
,
&
fss_current
.
name
[
1
],
plen
);
buf
[
plen
]
=
0
;
/* Special case for disk names */
if
(
fss_current
.
parID
<=
1
)
{
buf
[
plen
++
]
=
':'
;
buf
[
plen
]
=
0
;
return
0
;
}
while
(
fss_current
.
parID
>
1
)
{
/* Get parent folder name */
if
(
err
=
get_folder_parent
(
&
fss_current
,
&
fss_parent
))
return
err
;
fss_current
=
fss_parent
;
/* Prepend path component just found to buf */
plen
=
fss_current
.
name
[
0
];
if
(
strlen
(
buf
)
+
plen
+
1
>
1024
)
{
/* Oops... Not enough space (shouldn't happen) */
*
buf
=
0
;
return
-
1
;
}
memcpy
(
tmpbuf
,
&
fss_current
.
name
[
1
],
plen
);
tmpbuf
[
plen
]
=
':'
;
strcpy
(
&
tmpbuf
[
plen
+
1
],
buf
);
strcpy
(
buf
,
tmpbuf
);
}
return
0
;
}
/* Check that there aren't any args remaining in the event */
static
OSErr
...
...
Mac/Python/macglue.c
View file @
741e0378
...
...
@@ -232,6 +232,66 @@ char *PyMac_getscript()
}
}
/* Given an FSSpec, return the FSSpec of the parent folder */
static
OSErr
get_folder_parent
(
FSSpec
*
fss
,
FSSpec
*
parent
)
{
CInfoPBRec
rec
;
short
err
;
*
parent
=
*
fss
;
rec
.
hFileInfo
.
ioNamePtr
=
parent
->
name
;
rec
.
hFileInfo
.
ioVRefNum
=
parent
->
vRefNum
;
rec
.
hFileInfo
.
ioDirID
=
parent
->
parID
;
rec
.
hFileInfo
.
ioFDirIndex
=
-
1
;
rec
.
hFileInfo
.
ioFVersNum
=
0
;
if
(
err
=
PBGetCatInfoSync
(
&
rec
))
return
err
;
parent
->
parID
=
rec
.
dirInfo
.
ioDrParID
;
/* parent->name[0] = 0; */
return
0
;
}
/* Given an FSSpec return a full, colon-separated pathname */
OSErr
PyMac_GetFullPath
(
FSSpec
*
fss
,
char
*
buf
)
{
short
err
;
FSSpec
fss_parent
,
fss_current
;
char
tmpbuf
[
1024
];
int
plen
;
fss_current
=
*
fss
;
plen
=
fss_current
.
name
[
0
];
memcpy
(
buf
,
&
fss_current
.
name
[
1
],
plen
);
buf
[
plen
]
=
0
;
/* Special case for disk names */
if
(
fss_current
.
parID
<=
1
)
{
buf
[
plen
++
]
=
':'
;
buf
[
plen
]
=
0
;
return
0
;
}
while
(
fss_current
.
parID
>
1
)
{
/* Get parent folder name */
if
(
err
=
get_folder_parent
(
&
fss_current
,
&
fss_parent
))
return
err
;
fss_current
=
fss_parent
;
/* Prepend path component just found to buf */
plen
=
fss_current
.
name
[
0
];
if
(
strlen
(
buf
)
+
plen
+
1
>
1024
)
{
/* Oops... Not enough space (shouldn't happen) */
*
buf
=
0
;
return
-
1
;
}
memcpy
(
tmpbuf
,
&
fss_current
.
name
[
1
],
plen
);
tmpbuf
[
plen
]
=
':'
;
strcpy
(
&
tmpbuf
[
plen
+
1
],
buf
);
strcpy
(
buf
,
tmpbuf
);
}
return
0
;
}
#ifdef USE_GUSI1
/*
...
...
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