Kaydet (Commit) 06033198 authored tarafından Jack Jansen's avatar Jack Jansen

Use MacOS.openrf (if it is available) for opening resource forks

Copy in .5Mb chunks in stead of 1Mb
üst db9ff36a
...@@ -8,12 +8,18 @@ import macfs ...@@ -8,12 +8,18 @@ import macfs
import Res import Res
import os import os
from MACFS import * from MACFS import *
import MacOS
try:
openrf = MacOS.openrf
except AttributeError:
# Backward compatability
openrf = open
Error = 'macostools.Error' Error = 'macostools.Error'
FSSpecType = type(macfs.FSSpec(':')) 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 # Not guaranteed to be correct or stay correct (Apple doesn't tell you
...@@ -64,8 +70,8 @@ def copy(src, dst, createpath=0): ...@@ -64,8 +70,8 @@ def copy(src, dst, createpath=0):
ifp.close() ifp.close()
ofp.close() ofp.close()
ifp = open(srcfss.as_pathname(), '*rb') ifp = openrf(srcfss.as_pathname(), '*rb')
ofp = open(dstfss.as_pathname(), '*wb') ofp = openrf(dstfss.as_pathname(), '*wb')
d = ifp.read(BUFSIZ) d = ifp.read(BUFSIZ)
while d: while d:
ofp.write(d) ofp.write(d)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment