本文整理匯總了Python中Carbon.Files.fsRdWrPerm方法的典型用法代碼示例。如果您正苦於以下問題:Python Files.fsRdWrPerm方法的具體用法?Python Files.fsRdWrPerm怎麽用?Python Files.fsRdWrPerm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Carbon.Files
的用法示例。
在下文中一共展示了Files.fsRdWrPerm方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: writePlistToResource
# 需要導入模塊: from Carbon import Files [as 別名]
# 或者: from Carbon.Files import fsRdWrPerm [as 別名]
def writePlistToResource(rootObject, path, restype='plst', resid=0):
"""Write 'rootObject' as a plst resource to the resource fork of path.
"""
warnings.warnpy3k("In 3.x, writePlistToResource is removed.", stacklevel=2)
from Carbon.File import FSRef, FSGetResourceForkName
from Carbon.Files import fsRdWrPerm
from Carbon import Res
plistData = writePlistToString(rootObject)
fsRef = FSRef(path)
resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm)
Res.UseResFile(resNum)
try:
Res.Get1Resource(restype, resid).RemoveResource()
except Res.Error:
pass
res = Res.Resource(plistData)
res.AddResource(restype, resid, '')
res.WriteResource()
Res.CloseResFile(resNum)