#include "shell.hpp" // add a given location to a logical file void shell::c_log_add (std::string args) { // split args into source and target std::string src = args; std::string url = args; size_t idx = args.find (" "); if ( idx != 0 && idx != std::string::npos ) { src.erase (idx); url.erase (0, idx + 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 add replica to 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); // add the new logical_file lf.add_location (saga::url (url)); // logical file and dir close when going out of scope return; }