12 file = os.path.join(dir,file)
15 contents = f.read().split('\n')
21 elif match == 1
and line ==
'lore':
23 elif match == 2
and line ==
'endmaplore':
27 lfile.write(
'%s\n' %(line))
31 except (OSError, IOError):
37 contents = f.read().split('\n')
40 if line[:5] ==
'name ':
43 elif match == 1
and line ==
'lore':
45 lfile.write(
"lore\n%s\n" %tempname)
47 elif match == 2
and line ==
'endlore':
49 lfile.write(
"endlore\n")
52 lfile.write(
'%s\n' %(line))
56 except (OSError, IOError):
60 if __name__ ==
'__main__':
63 sys.stderr.write (
'Collects lore from maps and arches into a single file\nUsage: loreCollect.py <map directory root> <path to archetypes file> <target filename>')
66 lfile = open(sys.argv[3],
'w')
67 print "Collecting map lore...this may take a minute"
68 os.path.walk(sys.argv[1],mapLoreCollect,lfile)
69 print "Collecting arch lore..."
72 print "finished collecting lore"