diff --git a/src/bottles/activate.cpp b/src/bottles/activate.cpp index ef5033f..c522966 100644 --- a/src/bottles/activate.cpp +++ b/src/bottles/activate.cpp @@ -8,13 +8,14 @@ #include "bottles.hpp" #include "internal/bottles.hpp" +#include "output.hpp" using namespace std; using namespace boost::filesystem; void cellar::bottles::switch_active_bottle(int argc, vector argv) { if (argc == 1) { - cout << "forgot to specify a bottle to activate" << endl; + output::error("forgot to specify a bottle to activate"); return; } @@ -24,7 +25,7 @@ void cellar::bottles::switch_active_bottle(int argc, vector argv) { file_status targetstatus = symlink_status(targetpath); if (!exists(targetstatus)) { - cerr << "target " << targetpath << " does not exist" << endl; + output::error("target " + targetpath + " does not exist"); return; } @@ -32,12 +33,17 @@ void cellar::bottles::switch_active_bottle(int argc, vector argv) { if (exists(bottlestatus)) { bool bottlesymlink = is_symlink(bottlestatus); if (!bottlesymlink) { - cerr << "refusing to clobber " << bottlepath << ": not a symlink" << endl; + output::error("refusing to clobber " + bottlepath + ": not a symlink"); return; } remove(bottlepath); } // TODO: not blindly assume this will magically work - create_symlink(targetpath, bottlepath); + try { + create_symlink(targetpath, bottlepath); + } catch (filesystem_error &exc) { + output::error(exc.what()); + return; + } } diff --git a/src/bottles/remove.cpp b/src/bottles/remove.cpp index 5989348..9d1c6d5 100644 --- a/src/bottles/remove.cpp +++ b/src/bottles/remove.cpp @@ -19,7 +19,7 @@ void cellar::bottles::remove_bottle(int argc, vector argv) { string fullbottlepath; if (bottlechoice.substr(0,1) == "/" || bottlechoice.substr(0,1) == "." || bottlechoice.substr(0,1) == "~") { // absolute or relative path output::error("paths not accepted"); - return 1; + return; } else { if (bottlechoice.substr(0,6) == ".wine.") { output::statement("tip: cellar can add the \".wine.\" prefix automatically");