From 73e6666cbc77289727a7f7f944994fddc344616d Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 30 Jul 2009 11:40:16 +0800 Subject: [PATCH] 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. --- pyfpdb/HandHistoryConverter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index f5d46034..2ded2c50 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -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