- Timestamp:
- Apr 29, 2008, 12:37:07 AM (15 years ago)
- Location:
- trunk/bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/Parameter.cc
r631 r632 44 44 : config_file_(""), copyright_(false), force_(false), 45 45 generate_config_(false), ignore_cache_(false), report_(true), 46 revisions_(false), root_("."), targetdir_("."), verbose_(false) 46 revisions_(false), root_("."), root_node_("."), targetdir_("."), 47 verbose_(false) 47 48 { 48 49 for (int i=1; i<argc; ++i) { … … 138 139 string workdir(pwd()); // remember current working directory (cwd). 139 140 140 bool root_ok = ( node_exist(root_.value()) && 141 !access_rights(root_.value(), "r") ); 142 143 if (root_ok) { 144 // Check that root_ is a directory 145 struct stat nodestat; 146 stat(root_.value().c_str(), &nodestat); 147 if (!S_ISDIR(nodestat.st_mode)) 148 throw runtime_error(string("svndigest: accessing `") + root_.value() + 149 "': Not a directory."); 141 if (!node_exist(root_.value())) 142 throw runtime_error(string("svndigest: cannot stat `" + root_.value() + 143 "': no such file or directory")); 144 145 if (access_rights(root_.value(), "r")) 146 throw runtime_error(string("svndigest: cannot open `" + root_.value() + 147 "' for reading: Permission denied")); 148 149 // Check whether root is directory or file 150 struct stat nodestat; 151 stat(root_.value().c_str(), &nodestat); 152 if (S_ISDIR(nodestat.st_mode)) { 153 chdir(root_.value().c_str()); 154 root_node_.value() = root_.value() = pwd(); 150 155 } 151 152 // Checking that root_ exists and retrieve the absolute path to root_ 153 if (!root_ok || chdir(root_.value().c_str())) 154 throw runtime_error(string("svndigest: Root directory (") + root_.value() + 155 ") access failed."); 156 root_.value() = pwd(); 157 158 156 else { 157 std::string fname = file_name(root_.value()); 158 root_.value() = directory_name(root_.value()); 159 chdir(root_.value().c_str()); 160 root_.value() = pwd(); 161 root_node_.value() = root_.value() + "/" + fname; 162 } 159 163 160 164 // need to get back to cwd if relative paths are used. -
trunk/bin/Parameter.h
r626 r632 48 48 /// @return absolute path to root directory 49 49 inline const std::string& root(void) const { return root_.value(); } 50 /// @return absolute path to root node 51 inline const std::string& root_node(void) const {return root_node_.value();} 50 52 /// @return absolute path to target directory 51 53 inline const std::string& targetdir(void) const … … 67 69 Option<bool> revisions_; 68 70 Option<std::string> root_; 71 Option<std::string> root_node_; 69 72 Option<std::string> targetdir_; 70 73 Option<bool> verbose_;
Note: See TracChangeset
for help on using the changeset viewer.