#include "shell.hpp" // update a given replica location void shell::c_log_update (std::string args) { // split args into source and target std::string src = args; std::string url1 = args; std::string url2 = args; size_t idx1 = args.find (" "); size_t idx2 = args.find (" ", idx1); if ( idx1 != 0 && idx1 != std::string::npos && idx2 != 0 && idx2 != std::string::npos ) { src.erase (idx1); url1.erase (0 , idx1 + 1); url2.erase (idx1, idx2 + 1); } else { carp ("format: log_add "); return; } // sanity checks if ( ! cwd_.exists (src) ) { carp ("No such logical file: " + src); return; } if ( cwd_.is_dir (src) ) { carp ("Cannot update replica locations on a directory: " + src); return; } // open the current directory as logical dir saga::logical_file::logical_directory dir (cwd_.get_url ()); // open the logical file saga::logical_file::logical_file lf = dir.open (src, saga::logical_file::Write); // update the replica location lf.update_location (saga::url (url1), saga::url (url2)); // logical file and dir close when going out of scope return; }