本文整理汇总了Python中FileUtils.isExist方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.isExist方法的具体用法?Python FileUtils.isExist怎么用?Python FileUtils.isExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.isExist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setSourceToSearch
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import isExist [as 别名]
def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False):
try:
if self.sourceToSearch is None or _isReload:
sourceToSearch = ""
self.isMultipleSource = False
pathToSearchs = str(self.lePathToSeach.text())
if fu.isExist(pathToSearchs) is False and pathToSearchs.find(";") != -1:
self.isMultipleSource = True
for pathToSearch in uni.getListFromListString(pathToSearchs, ";"):
if pathToSearch in self.sourceToSearchCache and _isLoadFromCache:
sourceToSearch += self.sourceToSearchCache[pathToSearch]
else:
pathToSearch = fu.checkSource(pathToSearch)
if pathToSearch is not None:
if fu.isReadableFileOrDir(pathToSearch):
if fu.isFile(pathToSearch) and fu.isBinary(pathToSearch) is False:
sts = fu.readFromFile(pathToSearch) + "\n"
sourceToSearch += sts
self.sourceToSearchCache[pathToSearch] = sts
elif fu.isDir(pathToSearch):
sts = fu.getFileTree(pathToSearch, -1, "return", "plainText", "fileList") + "\n"
sourceToSearch += sts
self.sourceToSearchCache[pathToSearch] = sts
self.sourceToSearch = sourceToSearch
if sourceToSearch != "":
return True
return False
else:
return True
except:
ReportBug.ReportBug()
示例2: generateReadOnlyEmbeddedD
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import isExist [as 别名]
def generateReadOnlyEmbeddedD(_isNoAlertIfSuccessfully=True):
stopReadOnlyEmbeddedDB()
if fu.isExist(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok"):
fu.removeFileOrDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok")
fu.copyFileOrDir(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/amarok",
fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok")
if _isNoAlertIfSuccessfully is False:
Dialogs.show(translate("EmbeddedDBCore", "Generated Embedded Server"),
translate("EmbeddedDBCore", "Embedded Amarok database server generated."))
return True