sync 1.7
This commit is contained in:
parent
c3f5ae06f4
commit
e3a59675c1
@ -75,3 +75,24 @@ def getTempPath(name):
|
||||
path = os.path.join(tempPath, name)
|
||||
return path
|
||||
|
||||
|
||||
# JSON配置文件路径
|
||||
jsonPathDict = {}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def getJsonPath(name, moduleFile):
|
||||
"""
|
||||
获取JSON配置文件的路径:
|
||||
1. 优先从当前工作目录查找JSON文件
|
||||
2. 若无法找到则前往模块所在目录查找
|
||||
"""
|
||||
currentFolder = os.getcwd()
|
||||
currentJsonPath = os.path.join(currentFolder, name)
|
||||
if os.path.isfile(currentJsonPath):
|
||||
jsonPathDict[name] = currentJsonPath
|
||||
return currentJsonPath
|
||||
|
||||
moduleFolder = os.path.abspath(os.path.dirname(moduleFile))
|
||||
moduleJsonPath = os.path.join(moduleFolder, '.', name)
|
||||
jsonPathDict[name] = moduleJsonPath
|
||||
return moduleJsonPath
|
||||
|
Loading…
Reference in New Issue
Block a user