cellar remove no longer supports paths. what is this, rm

This commit is contained in:
Nicholas O'Connor 2017-04-08 23:12:45 -07:00
parent 74997e7280
commit fa731102ff

View File

@ -17,16 +17,9 @@ void cellar::bottles::remove_bottle(int argc, vector<string> argv) {
string homepath = getenv("HOME"); string homepath = getenv("HOME");
string bottlechoice = argv[1]; string bottlechoice = argv[1];
string fullbottlepath; string fullbottlepath;
if (bottlechoice.substr(0,1) == "/" || bottlechoice.substr(0,1) == ".") { // absolute or relative path if (bottlechoice.substr(0,1) == "/" || bottlechoice.substr(0,1) == "." || bottlechoice.substr(0,1) == "~") { // absolute or relative path
fullbottlepath = bottlechoice; output::error("paths not accepted");
} else if (bottlechoice.substr(0,1) == "~") { // "absolute" path in home directory, not expanded by the shell for some reason (i've seen some shit) return 1;
// this is a naive replacement and will fail if the user tries something like ~nick/.wine
// i'm figuring at that point if you're doing that, you'll also recognize if your shell
// isn't actually expanding your path...
bottlechoice.replace(0,1,getenv("HOME"));
// or at least you'll think to use verbose mode to make sure it's loading the right directory
output::warning("your shell didn't expand your given path properly, doing a naive replacement", true);
fullbottlepath = bottlechoice;
} else { } else {
if (bottlechoice.substr(0,6) == ".wine.") { if (bottlechoice.substr(0,6) == ".wine.") {
output::statement("tip: cellar can add the \".wine.\" prefix automatically"); output::statement("tip: cellar can add the \".wine.\" prefix automatically");