Add auto folder creation to HHC

Contributed by grindi on 2+2 http://forumserver.twoplustwo.com/showpost.php?p=12156328&postcount=1666

Creates the sub folders of hhArchiveBase for placing the converted files in.
This commit is contained in:
Worros 2009-07-30 11:40:16 +08:00
parent 298de5dc15
commit 73e6666cbc

View File

@ -57,6 +57,10 @@ class HandHistoryConverter():
self.out_fh = sys.stdout
else:
# TODO: out_path should be sanity checked.
out_dir = os.path.dirname(self.out_path)
if not os.path.isdir(out_dir):
logging.info("Creatin directory '%s'" % out_dir)
os.makedirs(out_dir)
self.out_fh = open(self.out_path, 'w')
self.sitename = sitename