From 5c6793d37354b8e9fcc499e561aaf339ef51f01d Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 21 Feb 2009 22:06:10 +0900 Subject: [PATCH] Add sanity check to HHC Make sure input file and output file are different so we dont overwrite the source. --- pyfpdb/HandHistoryConverter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index c6e8d130..45912ee7 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -89,7 +89,6 @@ class HandHistoryConverter: self.hhdir = os.path.join(self.hhbase,sitename) self.gametype = [] self.ofile = os.path.join(self.hhdir, os.path.basename(file)) - print self.ofile self.rexx = FpdbRegex.FpdbRegex() self.players = set() @@ -238,6 +237,10 @@ class HandHistoryConverter: else: print "HH Sanity Check: Directory hhdir '" + self.hhdir + "' or its parent directory are not writable" + # Make sure input and output files are different or we'll overwrite the source file + if(self.ofile == self.file): + print "HH Sanity Check: output and input files are the same, check config" + return sane # Functions not necessary to implement in sub class