From adeafb1d49ac5cea51dc88318d35b899b025fa2c Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Tue, 15 Sep 2009 13:26:08 -0400 Subject: [PATCH] restore: use default arg instead of positional for dump directory. check for valid directory before drilling down --- tools/restore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/restore.cpp b/tools/restore.cpp index f49f72524c8..d2d123ea2d7 100644 --- a/tools/restore.cpp +++ b/tools/restore.cpp @@ -33,14 +33,18 @@ class Restore : public Tool { public: Restore() : Tool( "restore" ){ add_options() - ("dir",po::value() , "directory to restore from" ) + ("dir", po::value()->default_value("dump"), "directory to restore from") ; - addPositionArg( "dir" , 1 ); } int run(){ auth(); - drillDown( getParam( "dir" ) ); + path root = getParam("dir"); + if (!is_directory(root)) { + cerr << "\"" << root.string() << "\" is not a valid directory" << endl; + return EXIT_BADOPTIONS; + } + drillDown(root); return 0; }