本文整理汇总了Python中fofix.core.VFS.getWritableResourcePath方法的典型用法代码示例。如果您正苦于以下问题:Python VFS.getWritableResourcePath方法的具体用法?Python VFS.getWritableResourcePath怎么用?Python VFS.getWritableResourcePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.core.VFS
的用法示例。
在下文中一共展示了VFS.getWritableResourcePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from fofix.core import VFS [as 别名]
# 或者: from fofix.core.VFS import getWritableResourcePath [as 别名]
def __init__(self, prototype, fileName=None, type=0):
"""
@param prototype: The configuration prototype mapping
@param fileName: The file that holds this configuration registry
"""
self.prototype = prototype
# read configuration
self.config = MyConfigParser()
if fileName:
if not os.path.isfile(fileName):
path = VFS.getWritableResourcePath()
fileName = os.path.join(path, fileName)
self.config.read(fileName)
self.fileName = fileName
self.type = type
# fix the defaults and non-existing keys
for section, options in prototype.items():
if not self.config.has_section(section):
self.config.add_section(section)
for option in options.keys():
type = options[option].type
default = options[option].default
if not self.config.has_option(section, option):
self.config.set(section, option, str(default))
示例2: load_config
# 需要导入模块: from fofix.core import VFS [as 别名]
# 或者: from fofix.core.VFS import getWritableResourcePath [as 别名]
def load_config(configPath):
''' Load the configuration file. '''
if configPath is not None:
if configPath.lower() == "reset":
# Get os specific location of config file, and remove it.
fileName = os.path.join(VFS.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
os.remove(fileName)
# Recreate it
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
else:
# Load specified config file
config = Config.load(configPath, setAsDefault = True)
else:
# Use default configuration file
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
return config