Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68438 - sandbox/tools/auto_index/src
From: john_at_[hidden]
Date: 2011-01-25 13:45:49


Author: johnmaddock
Date: 2011-01-25 13:45:42 EST (Tue, 25 Jan 2011)
New Revision: 68438
URL: http://svn.boost.org/trac/boost/changeset/68438

Log:
Add some error handling for invalid file names.
Text files modified:
   sandbox/tools/auto_index/src/auto_index.cpp | 2 ++
   sandbox/tools/auto_index/src/file_scanning.cpp | 4 ++++
   2 files changed, 6 insertions(+), 0 deletions(-)

Modified: sandbox/tools/auto_index/src/auto_index.cpp
==============================================================================
--- sandbox/tools/auto_index/src/auto_index.cpp (original)
+++ sandbox/tools/auto_index/src/auto_index.cpp 2011-01-25 13:45:42 EST (Tue, 25 Jan 2011)
@@ -552,6 +552,8 @@
       }
       else if(std::strncmp(argv[i], "scan=", 5) == 0)
       {
+ if(!exists(boost::filesystem::path(argv[i] + 5)))
+ throw std::runtime_error("Error the file requested for scanning does not exist: " + std::string(argv[i] + 5));
          scan_file(argv[i] + 5);
       }
       else if(std::strncmp(argv[i], "script=", 7) == 0)

Modified: sandbox/tools/auto_index/src/file_scanning.cpp
==============================================================================
--- sandbox/tools/auto_index/src/file_scanning.cpp (original)
+++ sandbox/tools/auto_index/src/file_scanning.cpp 2011-01-25 13:45:42 EST (Tue, 25 Jan 2011)
@@ -331,6 +331,8 @@
                f = base.string();
             }
          }
+ if(!exists(boost::filesystem::path(f)))
+ throw std::runtime_error("Error the file requested for scanning does not exist: " + f);
          scan_file(f.c_str());
       }
       else if(regex_match(line, what, debug_parser))
@@ -365,6 +367,8 @@
          }
          if(verbose)
             std::cout << "Scanning directory " << d << std::endl;
+ if(!exists(boost::filesystem::path(d)))
+ throw std::runtime_error("Error the path requested for scanning does not exist: " + d);
          scan_dir(d, m, r);
       }
       else if(regex_match(line, what, rewrite_parser))


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk