Commit 43c2c52 1 parent c2e7718 commit 43c2c52 Copy full SHA for 43c2c52
File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -295,13 +295,20 @@ let create
295
295
let simulate = OpamStateConfig. (! r.dryrun) || OpamClientConfig. (! r.show) in
296
296
if OpamGlobalState. switch_exists gt switch then
297
297
OpamConsole. error_and_exit `Bad_arguments
298
- " There already is an installed switch named %s"
298
+ " There already is an installed switch named %s.\n \
299
+ Please see https://opam.ocaml.org/doc/FAQ.html#switch-already-present"
299
300
(OpamSwitch. to_string switch);
300
301
if Sys. file_exists (OpamFilename.Dir. to_string comp_dir) then
301
- OpamConsole. error_and_exit `Bad_arguments
302
- " Directory %S already exists, please choose a different name"
303
- (OpamFilename.Dir. to_string comp_dir);
304
- let gt, st =
302
+ if not (OpamFilename. dir_is_empty comp_dir) then
303
+ OpamConsole. error_and_exit `Bad_arguments
304
+ " Directory %S already exists, please choose a different name"
305
+ (OpamFilename.Dir. to_string comp_dir)
306
+ else
307
+ if not (OpamConsole. confirm
308
+ " Directory %S exitst and is empty, remove it?" ) then
309
+ OpamConsole. error_and_exit `Aborted " Remove %S directory and recreate switch"
310
+ else
311
+ let gt, st =
305
312
if not simulate then
306
313
let gt =
307
314
OpamSwitchAction. create_empty_switch gt ?synopsis ?repos ~invariant
You can’t perform that action at this time.
0 commit comments