From 82dc5255b66a5fa7d8e5819bc816cdbc0b860129 Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Wed, 5 Jul 2017 15:40:29 -0700 Subject: [PATCH] activate can now be run dry --- src/bottles/activate.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bottles/activate.cpp b/src/bottles/activate.cpp index e19293d..dd9bfc7 100644 --- a/src/bottles/activate.cpp +++ b/src/bottles/activate.cpp @@ -7,6 +7,7 @@ #include #include "bottles.hpp" +#include "cellar.hpp" #include "internal/bottles.hpp" #include "output.hpp" @@ -36,9 +37,12 @@ void cellar::bottles::switch_active_bottle(int argc, vector argv) { output::error("refusing to clobber " + bottlepath + ": not a symlink"); return; } - remove(bottlepath); + output::statement("removing existing symlink at " + bottlepath, true); + if (!cellar::dryrun) { remove(bottlepath); } } + output::statement("creating symlink to " + targetpath + " at " + bottlepath, true); + if (cellar::dryrun) { return; } // TODO: not blindly assume this will magically work try { create_symlink(targetpath, bottlepath);