当前位置: 首页>>代码示例>>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;未经允许,请勿转载。