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
0bdf979a
Commit
0bdf979a
authored
Sep 15, 1996
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added [GS]etDates methods to get and set creation, modification and
backup times.
parent
a39a25e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
Mac/Modules/macfsmodule.c
Mac/Modules/macfsmodule.c
+88
-0
No files found.
Mac/Modules/macfsmodule.c
View file @
0bdf979a
...
...
@@ -347,6 +347,54 @@ mfs_GetFSSpecFSSpec(self)
return
NULL
;
}
/*
** Two generally useful routines
*/
static
OSErr
PyMac_GetFileDates
(
fss
,
crdat
,
mddat
,
bkdat
)
FSSpec
*
fss
;
unsigned
long
*
crdat
,
*
mddat
,
*
bkdat
;
{
CInfoPBRec
pb
;
OSErr
error
;
pb
.
dirInfo
.
ioNamePtr
=
fss
->
name
;
pb
.
dirInfo
.
ioFDirIndex
=
0
;
pb
.
dirInfo
.
ioVRefNum
=
fss
->
vRefNum
;
pb
.
dirInfo
.
ioDrDirID
=
fss
->
parID
;
error
=
PBGetCatInfoSync
(
&
pb
);
if
(
error
)
return
error
;
*
crdat
=
pb
.
hFileInfo
.
ioFlCrDat
;
*
mddat
=
pb
.
hFileInfo
.
ioFlMdDat
;
*
bkdat
=
pb
.
hFileInfo
.
ioFlBkDat
;
return
0
;
}
static
OSErr
PyMac_SetFileDates
(
fss
,
crdat
,
mddat
,
bkdat
)
FSSpec
*
fss
;
unsigned
long
crdat
,
mddat
,
bkdat
;
{
CInfoPBRec
pb
;
OSErr
error
;
pb
.
dirInfo
.
ioNamePtr
=
fss
->
name
;
pb
.
dirInfo
.
ioFDirIndex
=
0
;
pb
.
dirInfo
.
ioVRefNum
=
fss
->
vRefNum
;
pb
.
dirInfo
.
ioDrDirID
=
fss
->
parID
;
error
=
PBGetCatInfoSync
(
&
pb
);
if
(
error
)
return
error
;
pb
.
dirInfo
.
ioNamePtr
=
fss
->
name
;
pb
.
dirInfo
.
ioFDirIndex
=
0
;
pb
.
dirInfo
.
ioVRefNum
=
fss
->
vRefNum
;
pb
.
dirInfo
.
ioDrDirID
=
fss
->
parID
;
pb
.
hFileInfo
.
ioFlCrDat
=
crdat
;
pb
.
hFileInfo
.
ioFlMdDat
=
mddat
;
pb
.
hFileInfo
.
ioFlBkDat
=
bkdat
;
error
=
PBSetCatInfoSync
(
&
pb
);
return
error
;
}
static
object
*
mfss_as_pathname
(
self
,
args
)
mfssobject
*
self
;
...
...
@@ -507,6 +555,44 @@ mfss_SetFInfo(self, args)
return
None
;
}
static
object
*
mfss_GetDates
(
self
,
args
)
mfssobject
*
self
;
object
*
args
;
{
OSErr
err
;
unsigned
long
crdat
,
mddat
,
bkdat
;
if
(
!
newgetargs
(
args
,
""
))
return
NULL
;
err
=
PyMac_GetFileDates
(
&
self
->
fsspec
,
&
crdat
,
&
mddat
,
&
bkdat
);
if
(
err
)
{
PyErr_Mac
(
ErrorObject
,
err
);
return
NULL
;
}
return
mkvalue
(
"ddd"
,
(
double
)
crdat
,
(
double
)
mddat
,
(
double
)
bkdat
);
}
static
object
*
mfss_SetDates
(
self
,
args
)
mfssobject
*
self
;
object
*
args
;
{
OSErr
err
;
double
crdat
,
mddat
,
bkdat
;
if
(
!
newgetargs
(
args
,
"ddd"
,
&
crdat
,
&
mddat
,
&
bkdat
))
return
NULL
;
err
=
PyMac_SetFileDates
(
&
self
->
fsspec
,
(
unsigned
long
)
crdat
,
(
unsigned
long
)
mddat
,
(
unsigned
long
)
bkdat
);
if
(
err
)
{
PyErr_Mac
(
ErrorObject
,
err
);
return
NULL
;
}
INCREF
(
None
);
return
None
;
}
static
struct
methodlist
mfss_methods
[]
=
{
{
"as_pathname"
,
(
method
)
mfss_as_pathname
,
1
},
{
"as_tuple"
,
(
method
)
mfss_as_tuple
,
1
},
...
...
@@ -516,6 +602,8 @@ static struct methodlist mfss_methods[] = {
{
"SetCreatorType"
,
(
method
)
mfss_SetCreatorType
,
1
},
{
"GetFInfo"
,
(
method
)
mfss_GetFInfo
,
1
},
{
"SetFInfo"
,
(
method
)
mfss_SetFInfo
,
1
},
{
"GetDates"
,
(
method
)
mfss_GetDates
,
1
},
{
"SetDates"
,
(
method
)
mfss_SetDates
,
1
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
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