Add sanity check to HHC

Make sure input file and output file are different so we dont overwrite
the source.
This commit is contained in:
Worros 2009-02-21 22:06:10 +09:00
parent 420c4fec69
commit 5c6793d373

View File

@ -89,7 +89,6 @@ class HandHistoryConverter:
self.hhdir = os.path.join(self.hhbase,sitename) self.hhdir = os.path.join(self.hhbase,sitename)
self.gametype = [] self.gametype = []
self.ofile = os.path.join(self.hhdir, os.path.basename(file)) self.ofile = os.path.join(self.hhdir, os.path.basename(file))
print self.ofile
self.rexx = FpdbRegex.FpdbRegex() self.rexx = FpdbRegex.FpdbRegex()
self.players = set() self.players = set()
@ -238,6 +237,10 @@ class HandHistoryConverter:
else: else:
print "HH Sanity Check: Directory hhdir '" + self.hhdir + "' or its parent directory are not writable" 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 return sane
# Functions not necessary to implement in sub class # Functions not necessary to implement in sub class