Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4842 Modified Files: macostools.py Log Message: In copy() don't try to obtain an FSSpec until we know the destination exists. Partial fix for #585923. Index: macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macostools.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** macostools.py 3 Aug 2002 20:49:10 -0000 1.15 --- macostools.py 5 Aug 2002 21:53:57 -0000 1.16 *************** *** 28,31 **** --- 28,33 ---- """Create a finder alias""" srcfss = macfs.FSSpec(src) + # The next line will fail under unix-Python if the destination + # doesn't exist yet. We should change this code to be fsref-based. dstfss = macfs.FSSpec(dst) if relative: *************** *** 83,93 **** def copy(src, dst, createpath=0, copydates=1, forcetype=None): """Copy a file, including finder info, resource fork, etc""" if createpath: mkdirs(os.path.split(dst)[0]) - srcfss = macfs.FSSpec(src) - dstfss = macfs.FSSpec(dst) ! ifp = open(srcfss.as_pathname(), 'rb') ! ofp = open(dstfss.as_pathname(), 'wb') d = ifp.read(BUFSIZ) while d: --- 85,97 ---- def copy(src, dst, createpath=0, copydates=1, forcetype=None): """Copy a file, including finder info, resource fork, etc""" + if hasattr(src, 'as_pathname'): + src = src.as_pathname() + if hasattr(dst, 'as_pathname'): + dst = dst.as_pathname() if createpath: mkdirs(os.path.split(dst)[0]) ! ifp = open(src, 'rb') ! ofp = open(dst, 'wb') d = ifp.read(BUFSIZ) while d: *************** *** 97,102 **** ofp.close() ! ifp = openrf(srcfss.as_pathname(), '*rb') ! ofp = openrf(dstfss.as_pathname(), '*wb') d = ifp.read(BUFSIZ) while d: --- 101,106 ---- ofp.close() ! ifp = openrf(src, '*rb') ! ofp = openrf(dst, '*wb') d = ifp.read(BUFSIZ) while d: *************** *** 106,109 **** --- 110,115 ---- ofp.close() + srcfss = macfs.FSSpec(src) + dstfss = macfs.FSSpec(dst) sf = srcfss.GetFInfo() df = dstfss.GetFInfo()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4