#include "shell.hpp" void shell::c_rmdir (std::string args) { // sanity checks if ( ! cwd_.exists (args) ) { carp ("Does not exist: " + args); return; } if ( ! cwd_.is_dir (args) ) { carp ("Is not a directory: " + args); return; } if ( 0 == args.find (".") && 1 == args.length () ) { carp ("will not remove './'"); return; } if ( 0 == args.find ("./") && 2 == args.length () ) { carp ("will not remove './'"); return; } if ( 0 == args.find ("../") ) { carp ("will not remove relative dirs"); return; } // check with the user again if she REALLY wants to // remove the dir... prompt ("Do you want to remove " + args + "?", "[y/N] >"); std::string input; getline (std::cin, input); if ( input == "y" || input == "Y" ) { // remove it cwd_.remove (args, saga::filesystem::Recursive); } return; }