extracttests.py: create output folders if they dont exist

This commit is contained in:
Daniel Marjamäki 2011-12-04 21:46:56 +01:00
parent 501d7ccb2d
commit e9546c5042
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ Extract test cases information from Cppcheck test
file file
""" """
import os
import sys import sys
import re import re
@ -179,6 +180,8 @@ if filename != None:
elif htmldir != None: elif htmldir != None:
if not htmldir.endswith('/'): if not htmldir.endswith('/'):
htmldir += '/' htmldir += '/'
if not os.path.exists(htmldir):
os.mkdir(htmldir)
findex = open(htmldir + 'index.htm', 'w') findex = open(htmldir + 'index.htm', 'w')
findex.write('<html>\n') findex.write('<html>\n')
findex.write('<head>\n') findex.write('<head>\n')
@ -241,6 +244,10 @@ if filename != None:
if not codedir.endswith('/'): if not codedir.endswith('/'):
codedir = codedir + '/' codedir = codedir + '/'
if not os.path.exists(codedir):
os.mkdir(codedir)
errors = open(codedir+'errors.txt', 'w') errors = open(codedir+'errors.txt', 'w')
for node in e.nodes: for node in e.nodes: