summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-03-12 13:33:34 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-03-12 13:33:34 (GMT)
commit06033198469812d1c9297b09b36da42f5dacedee (patch)
tree59d6a90ad3097dd648f72d7cb8f5e4ee035e6d22 /Mac
parentdb9ff36ad9944deed06eb2abb511ca972d4b0807 (diff)
downloadcpython-06033198469812d1c9297b09b36da42f5dacedee.zip
cpython-06033198469812d1c9297b09b36da42f5dacedee.tar.gz
cpython-06033198469812d1c9297b09b36da42f5dacedee.tar.bz2
Use MacOS.openrf (if it is available) for opening resource forks
Copy in .5Mb chunks in stead of 1Mb
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Lib/macostools.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Mac/Lib/macostools.py b/Mac/Lib/macostools.py
index aa5eb60..1dcc47e 100644
--- a/Mac/Lib/macostools.py
+++ b/Mac/Lib/macostools.py
@@ -8,12 +8,18 @@ import macfs
import Res
import os
from MACFS import *
+import MacOS
+try:
+ openrf = MacOS.openrf
+except AttributeError:
+ # Backward compatability
+ openrf = open
Error = 'macostools.Error'
FSSpecType = type(macfs.FSSpec(':'))
-BUFSIZ=0x100000 # Copy in 1Mb chunks
+BUFSIZ=0x80000 # Copy in 0.5Mb chunks
#
# Not guaranteed to be correct or stay correct (Apple doesn't tell you
@@ -64,8 +70,8 @@ def copy(src, dst, createpath=0):
ifp.close()
ofp.close()
- ifp = open(srcfss.as_pathname(), '*rb')
- ofp = open(dstfss.as_pathname(), '*wb')
+ ifp = openrf(srcfss.as_pathname(), '*rb')
+ ofp = openrf(dstfss.as_pathname(), '*wb')
d = ifp.read(BUFSIZ)
while d:
ofp.write(d)