From: Philippe E. <ph...@us...> - 2003-08-23 15:09:10
|
Update of /cvsroot/oprofile/oprofile/pp In directory sc8-pr-cvs1:/tmp/cvs-serv2172/pp Modified Files: common_option.cpp Log Message: pp/common_option.cpp: validate --image-path parameters Index: common_option.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/common_option.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -d -r1.2 -r1.3 --- common_option.cpp 29 May 2003 00:55:29 -0000 1.2 +++ common_option.cpp 23 Aug 2003 15:09:07 -0000 1.3 @@ -16,6 +16,7 @@ #include "popt_options.h" #include "cverb.h" #include "common_option.h" +#include "file_manip.h" using namespace std; @@ -75,6 +76,18 @@ vector<string> get_options(int argc, cha options::threshold = handle_threshold(::threshold); set_verbose(options::verbose); + + bool ok = true; + vector<string>::const_iterator it; + for (it = image_path.begin(); it != image_path.end(); ++it) { + if (!is_directory(*it)) { + cerr << *it << " isn't a valid directory\n"; + ok = false; + } + } + + if (!ok) + throw op_runtime_error("invalid --image-path= options"); options::extra_found_images.populate(image_path); |