Permalink
Browse files

Be more robust when a switch 's' does not appear in ~/.opam/aliases b…

…ut there is a ~/.opam/s directory. This is the sign that something bad happened while installed 's', so we ~/.opam/s to come back in a stable state.
  • Loading branch information...
1 parent fc307c5 commit 720daaf4e14983cec1138ad9f9c06c548208ded9 @samoht samoht committed Nov 15, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/client/opamState.ml
View
5 src/client/opamState.ml
@@ -663,6 +663,11 @@ let install_compiler t ~quiet switch compiler =
);
let switch_dir = OpamPath.Switch.root t.root switch in
+
+ (* Do some clean-up if necessary *)
+ if not (OpamSwitch.Map.mem switch t.aliases) && OpamFilename.exists_dir switch_dir then
+ OpamFilename.rmdir switch_dir;
+
if OpamFilename.exists_dir switch_dir then (
OpamGlobals.msg "The compiler %s is already installed.\n" (OpamSwitch.to_string switch);
OpamGlobals.exit 0;

0 comments on commit 720daaf

Please sign in to comment.