the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 62 lines 1.5 kB view raw
1 2import os 3import shutil 4import zipfile 5 6# 4J-JEV: Takes: 7# - Localisation from 'ServiceConfig\loc\ex-EX\index.html' 8# - Template help from 'ServiceConfig\HelpDocument\*' 9# 10# Then: 11# - Constructs all zipped files to 'ServiceConfig\HelpDocument_ex-EX.zip'. 12# 13# NOTE: Make sure to check out 'ServiceConfig\HelpDocument\*' first. 14 15def formatLoc(str): 16 [lang,local] = str.split('-') 17 return ( lang.lower() + "-" + local.upper() ) 18 19def copyTemplate(dst): 20 for root, dirs, files in os.walk(".\\HelpDocument\\"): 21 if not os.path.exists(dst+"\\"+root): 22 os.makedirs(dst+"\\"+root) 23 24 for f in filter(lambda x: x!="index.html", files): 25 if not os.path.isdir(root+"\\"+f): 26 print "Copying to '%s\\%s\\%s'" % (dst,root,f) 27 shutil.copyfile(root+"\\"+f, dst+"\\"+root+"\\"+f) 28 29def createZip(name): 30 os.chdir(".\\"+name) 31 32 zipname = name+".zip" 33 print "Created "+zipname 34 35 z = zipfile.ZipFile(zipname, 'w') 36 for root, dirs, files in os.walk(".\\HelpDocument\\"): 37 for file in files: 38 print "Adding '%s\\%s'." % (root,file) 39 z.write(os.path.join(root,file)) 40 41 z.close() 42 43 shutil.move(".\\"+zipname, "..\\"+zipname) 44 os.chdir("..") 45 46 47 48 #== MAIN ==# 49 50if __name__=="__main__": 51 for loc in map(formatLoc,os.listdir(".\\loc\\")): 52 tardir = ".\\HelpDocument_"+loc 53 54 if os.path.isdir(tardir): 55 shutil.rmtree(tardir) 56 copyTemplate(tardir+"\\") 57 58 print ( "Making '%s'" % tardir ) 59 shutil.copy(".\\loc\\"+loc+"\\index.html",tardir+"\\HelpDocument\\index.html") 60 61 createZip(tardir) 62 shutil.rmtree(tardir)