本文整理汇总了Python中FileSystem.FileSystem.getCurrentDirectory方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.getCurrentDirectory方法的具体用法?Python FileSystem.getCurrentDirectory怎么用?Python FileSystem.getCurrentDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.getCurrentDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: merge
# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import getCurrentDirectory [as 别名]
def merge(newConfigPath, oldConfigPath, destinationConfigPath, rulesPythonScript, isLogging, logDir, errorReporting, writeBackup):
#register rules
MergeRuleFactory.initialise()
MergeRuleFactory.registerRule("CopyValue", MergeRuleSingleShot)
MergeRuleFactory.registerRule("DeleteSection", MergeRuleDeleteNode)
MergeRuleFactory.registerRule("CopySection", MergeRuleSectionIntelligence)
#register XmlMerger
merger = XmlMerger()
if merger.initErrorReporting(errorReporting) is False:
print "Can`t init error reporting"
return False
pass
if isLogging is True:
if logDir is None:
logDir = FileSystem.getCurrentDirectory()
pass
if FileSystem.isDirectory(logDir) is False:
ErrorHandler.error("Directory for logs not exist %s " % logDir)
return False
pass
if merger.initLogging(logDir) is False:
ErrorHandler.error("can `t init Logger ")
return False
pass
if merger.initialise(newConfigPath, oldConfigPath) is False:
ErrorHandler.error("can `t initialise")
return False
pass
#add actions
#BE CAREFUL TUPLE WITH ONE ELEMENT = (element,) not (element) because in that case we shall have sequence (e,l,e,m,e,n,t) :-)
#merger.addAction( "SingleShot", GraphQuery(("general","systemtotaluptime")) )
#merger.addAction( "SectionIntelligence", GraphQuery(("myvideos",)) )
#merger.addAction( "SectionIntelligence", GraphQuery(("mymusic",)), BlackList = ["scanning"] )
#merger.addAction( "SectionIntelligence", GraphQuery(("viewstates",)) )
content = FileSystem.fileGetContents(rulesPythonScript)
execfile( rulesPythonScript, dict(merger = merger
, GraphQuery = GraphQuery
, QUERY_POLICY_ONLY_NEW = QUERY_POLICY_ONLY_NEW
, QUERY_POLICY_BOTH = QUERY_POLICY_BOTH) )
merger.merge()
if writeBackup is True:
backupPath = FileSystem.setFileExtension(oldConfigPath,"bak.xml")
FileSystem.copyFile(oldConfigPath, backupPath)
pass
if merger.save(destinationConfigPath) is False:
ErrorHandler.error("Error saving result %s. Please check directory write permissions." % destinationConfigPath)
return False
pass
return True
pass