修改获取文件名称方法
This commit is contained in:
@@ -55,6 +55,7 @@ class JsonTable:
|
|||||||
def comment(self):
|
def comment(self):
|
||||||
return self._comment
|
return self._comment
|
||||||
|
|
||||||
|
|
||||||
class ProjectJson:
|
class ProjectJson:
|
||||||
def __init__(self,dir:str) -> None:
|
def __init__(self,dir:str) -> None:
|
||||||
self._dir = dir
|
self._dir = dir
|
||||||
@@ -75,5 +76,19 @@ class ProjectJson:
|
|||||||
def tables(self):
|
def tables(self):
|
||||||
return self._tables
|
return self._tables
|
||||||
|
|
||||||
|
def getProjectName(dir:str):
|
||||||
|
result = dir.split('\\')
|
||||||
|
if len(result) > 0:
|
||||||
|
return result[-1]
|
||||||
|
return "未知工程名称"
|
||||||
|
|
||||||
|
prjJson = ProjectJson(dir)
|
||||||
|
prjJson.parse()
|
||||||
|
tb:JsonTable = prjJson.table('工程属性')
|
||||||
|
records = tb.records()
|
||||||
|
for record in records:
|
||||||
|
name = record.value('名称')
|
||||||
|
if name == '工程名称':
|
||||||
|
return record.value('值')
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user