#include "shell.hpp" // change the working directory void shell::c_cd (std::string args) { // have a nice default if ( args.empty() ) { cwd_.change_dir (home_); return; } // we actually try a real cd. If that fails, we try to create a new dir // instance with the arg, in case its switching to another namespace... // That's also why we don't bother about sanity checks at the moment. try { // do! :-) cwd_.change_dir (args); } catch ( const saga::exception & /*e*/ ) { // lets try the fallback saga::name_space::directory new_cwd (args, saga::name_space::ReadWrite); cwd_ = new_cwd; } return; }