aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Durango/ServiceConfig/MakeZips.py
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Durango/ServiceConfig/MakeZips.py
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Durango/ServiceConfig/MakeZips.py')
-rw-r--r--Minecraft.Client/Durango/ServiceConfig/MakeZips.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/Minecraft.Client/Durango/ServiceConfig/MakeZips.py b/Minecraft.Client/Durango/ServiceConfig/MakeZips.py
new file mode 100644
index 00000000..9b911002
--- /dev/null
+++ b/Minecraft.Client/Durango/ServiceConfig/MakeZips.py
@@ -0,0 +1,62 @@
+
+import os
+import shutil
+import zipfile
+
+# 4J-JEV: Takes:
+# - Localisation from 'ServiceConfig\loc\ex-EX\index.html'
+# - Template help from 'ServiceConfig\HelpDocument\*'
+#
+# Then:
+# - Constructs all zipped files to 'ServiceConfig\HelpDocument_ex-EX.zip'.
+#
+# NOTE: Make sure to check out 'ServiceConfig\HelpDocument\*' first.
+
+def formatLoc(str):
+ [lang,local] = str.split('-')
+ return ( lang.lower() + "-" + local.upper() )
+
+def copyTemplate(dst):
+ for root, dirs, files in os.walk(".\\HelpDocument\\"):
+ if not os.path.exists(dst+"\\"+root):
+ os.makedirs(dst+"\\"+root)
+
+ for f in filter(lambda x: x!="index.html", files):
+ if not os.path.isdir(root+"\\"+f):
+ print "Copying to '%s\\%s\\%s'" % (dst,root,f)
+ shutil.copyfile(root+"\\"+f, dst+"\\"+root+"\\"+f)
+
+def createZip(name):
+ os.chdir(".\\"+name)
+
+ zipname = name+".zip"
+ print "Created "+zipname
+
+ z = zipfile.ZipFile(zipname, 'w')
+ for root, dirs, files in os.walk(".\\HelpDocument\\"):
+ for file in files:
+ print "Adding '%s\\%s'." % (root,file)
+ z.write(os.path.join(root,file))
+
+ z.close()
+
+ shutil.move(".\\"+zipname, "..\\"+zipname)
+ os.chdir("..")
+
+
+
+ #== MAIN ==#
+
+if __name__=="__main__":
+ for loc in map(formatLoc,os.listdir(".\\loc\\")):
+ tardir = ".\\HelpDocument_"+loc
+
+ if os.path.isdir(tardir):
+ shutil.rmtree(tardir)
+ copyTemplate(tardir+"\\")
+
+ print ( "Making '%s'" % tardir )
+ shutil.copy(".\\loc\\"+loc+"\\index.html",tardir+"\\HelpDocument\\index.html")
+
+ createZip(tardir)
+ shutil.rmtree(tardir) \ No newline at end of file