def test_applesingle_resonly(self): try: os.unlink(TESTFN2) except: pass applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True) self.compareData(False, resourceforkdata)
def _decode(pathname, verbose = 0): newpathname = pathname + '.df.rsrc' if os.path.exists(newpathname) and os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: return newpathname if hasattr(os, 'access') and not os.access(os.path.dirname(pathname), os.W_OK | os.X_OK): import tempfile fd, newpathname = tempfile.mkstemp('.rsrc') if verbose: print 'Decoding', pathname, 'to', newpathname import applesingle applesingle.decode(pathname, newpathname, resonly=1) return newpathname
def _decode(pathname, verbose=0): newpathname = pathname + ".df.rsrc" if os.path.exists(newpathname) and os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: return newpathname if hasattr(os, "access") and not os.access(os.path.dirname(pathname), os.W_OK | os.X_OK): import tempfile fd, newpathname = tempfile.mkstemp(".rsrc") if verbose: print "Decoding", pathname, "to", newpathname import applesingle applesingle.decode(pathname, newpathname, resonly=1) return newpathname
def _decode(pathname, verbose=0): # Decode an AppleSingle resource file, return the new pathname. newpathname = pathname + '.df.rsrc' if os.path.exists(newpathname) and \ os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: return newpathname if hasattr(os, 'access') and not \ os.access(os.path.dirname(pathname), os.W_OK|os.X_OK): # The destination directory isn't writeable. Create the file in # a temporary directory import tempfile fd, newpathname = tempfile.mkstemp(".rsrc") if verbose: print 'Decoding', pathname, 'to', newpathname import applesingle applesingle.decode(pathname, newpathname, resonly=1) return newpathname