Skip to content

Commit

Permalink
chore: 添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Oct 11, 2023
1 parent 0b62591 commit 5b82e37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,19 @@ def remove_folder(folder):
#
#####################################################################

# 取最新的 Windows SDK
windowsSdkDir = sorted(glob.glob(programFilesX86Path + "\\Windows Kits\\10\\bin\\10.*"))[-1];
makepriPath = windowsSdkDir + "\\x64\\makepri.exe"
if not os.access(makepriPath, os.X_OK):
raise Exception("未找到 makepri")

# 将 resources.pri 的内容导出为 xml
if os.system("\"" + makepriPath + "\" dump /dt detailed /o") != 0:
raise Exception("dump 失败")

xmlTree = ElementTree.parse("resources.pri.xml")

# 在 xml 中删除冗余资源
for resourceNode in xmlTree.getroot().findall("ResourceMap/ResourceMapSubtree/ResourceMapSubtree/ResourceMapSubtree/NamedResource"):
name = resourceNode.get("name")

Expand Down Expand Up @@ -181,6 +184,7 @@ def remove_folder(folder):
</index>
</resources>""", file=f)

# 将 xml 重新封装成 pri
os.system("\"" + makepriPath + "\" new /pr . /cf priconfig.xml /in Magpie.App /o")

os.remove("resources.pri.xml")
Expand Down

0 comments on commit 5b82e37

Please sign in to comment.