[Python-checkins] CVS: python/dist/src/Mac/Lib macresource.py,1.4,1.5
Jack Jansen
jackjansen@users.sourceforge.net
Thu, 21 Mar 2002 14:38:34 -0800
Update of /cvsroot/python/python/dist/src/Mac/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13456
Modified Files:
macresource.py
Log Message:
Added an open_pathname() method which opens a resource file by pathname,
possibly converting from AppleSingle.
Index: macresource.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macresource.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** macresource.py 13 Jan 2002 23:18:00 -0000 1.4
--- macresource.py 21 Mar 2002 22:38:32 -0000 1.5
***************
*** 62,65 ****
--- 62,77 ----
raise ResourceFileNotFoundError, filename
+ refno = open_pathname(pathname)
+
+ # And check that the resource exists now
+ if type(resid) is type(1):
+ h = Res.GetResource(restype, resid)
+ else:
+ h = Res.GetNamedResource(restype, resid)
+ return refno
+
+ def open_pathname(pathname):
+ """Open a resource file given by pathname, possibly decoding an
+ AppleSingle file"""
try:
refno = Res.FSpOpenResFile(pathname, 1)
***************
*** 73,83 ****
else:
raise
-
-
- # And check that the resource exists now
- if type(resid) is type(1):
- h = Res.GetResource(restype, resid)
- else:
- h = Res.GetNamedResource(restype, resid)
return refno
--- 85,88 ----