Match compiler: Be more user friendly on how to invoke it

This commit is contained in:
Thomas Jarosch 2013-01-09 19:22:40 +01:00
parent ade0b741b7
commit e1be85a552
1 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import os import os
import sys
import re import re
import glob import glob
@ -485,6 +486,11 @@ class MatchCompiler:
# Main program # Main program
build_dir = 'build' build_dir = 'build'
# Check if we are invoked from the right place
if not os.path.exists('lib') and not os.path.exists('samples'):
print('Please invoke from the top level cppcheck source dir. Example: tools/matchcompiler.py')
sys.exit(-1)
# Create build directory if needed # Create build directory if needed
if not os.path.exists(build_dir): if not os.path.exists(build_dir):
os.makedirs(build_dir) os.makedirs(build_dir)