Something went wrong. Try again.
the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
Something went wrong. Try again.
1.5 kB · 62 lines
Python
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
import osimport shutilimport 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)