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)
评论列表
文章目录