當前位置: 首頁>>代碼示例>>Python>>正文


Python applesingle.decode方法代碼示例

本文整理匯總了Python中applesingle.decode方法的典型用法代碼示例。如果您正苦於以下問題:Python applesingle.decode方法的具體用法?Python applesingle.decode怎麽用?Python applesingle.decode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在applesingle的用法示例。


在下文中一共展示了applesingle.decode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _decode

# 需要導入模塊: import applesingle [as 別名]
# 或者: from applesingle import decode [as 別名]
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 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:19,代碼來源:macresource.py

示例2: test_applesingle

# 需要導入模塊: import applesingle [as 別名]
# 或者: from applesingle import decode [as 別名]
def test_applesingle(self):
        try:
            os.unlink(TESTFN2)
        except:
            pass
        applesingle.decode(test_support.TESTFN, TESTFN2)
        self.compareData(False, dataforkdata)
        self.compareData(True, resourceforkdata) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_applesingle.py

示例3: test_applesingle_resonly

# 需要導入模塊: import applesingle [as 別名]
# 或者: from applesingle import decode [as 別名]
def test_applesingle_resonly(self):
        try:
            os.unlink(TESTFN2)
        except:
            pass
        applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True)
        self.compareData(False, resourceforkdata) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_applesingle.py

示例4: resource_pathname

# 需要導入模塊: import applesingle [as 別名]
# 或者: from applesingle import decode [as 別名]
def resource_pathname(pathname, verbose=0):
    """Return the pathname for a resource file (either DF or RF based).
    If the pathname given already refers to such a file simply return it,
    otherwise first decode it."""
    # No resource fork. We may be on OSX, and this may be either
    # a data-fork based resource file or a AppleSingle file
    # from the CVS repository.
    try:
        refno = Res.FSOpenResourceFile(pathname, u'', 1)
    except Res.Error, arg:
        if arg[0] != -199:
            # -199 is "bad resource map"
            raise 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:macresource.py


注:本文中的applesingle.decode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。