rpath.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def write_carbonfile(self, cfile):
        """Write new carbon data to self."""
        if not cfile: return
        log.Log("Writing carbon data to %s" % (self.index,), 7)
        from Carbon.File import FSSpec
        from Carbon.File import FSRef
        import Carbon.Files
        import MacOS
        fsobj = FSSpec(self.path)
        finderinfo = fsobj.FSpGetFInfo()
        finderinfo.Creator = cfile['creator']
        finderinfo.Type = cfile['type']
        finderinfo.Location = cfile['location']
        finderinfo.Flags = cfile['flags']
        fsobj.FSpSetFInfo(finderinfo)

        """Write Creation Date to self (if stored in metadata)."""
        try:
            cdate = cfile['createDate']
            fsref = FSRef(fsobj)
            cataloginfo, d1, d2, d3 = fsref.FSGetCatalogInfo(Carbon.Files.kFSCatInfoCreateDate)
            cataloginfo.createDate = (0, cdate, 0)
            fsref.FSSetCatalogInfo(Carbon.Files.kFSCatInfoCreateDate, cataloginfo)
            self.set_carbonfile(cfile)
        except KeyError: self.set_carbonfile(cfile)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号