File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ package cmd
22
33import (
44 "fmt"
5+ "os"
56 "path"
7+ "strings"
68 "text/tabwriter"
79
810 "github.com/exercism/cli/config"
@@ -34,8 +36,16 @@ You can also override certain default settings to suit your preferences.
3436 if err != nil {
3537 return err
3638 }
39+ usrCfg .Normalize ()
3740 if usrCfg .Workspace == "" {
38- usrCfg .Workspace = path .Join (usrCfg .Home , path .Base (BinaryName ))
41+ dirName := strings .Replace (path .Base (BinaryName ), ".exe" , "" , 1 )
42+ defaultWorkspace := path .Join (usrCfg .Home , dirName )
43+ _ , err := os .Stat (defaultWorkspace )
44+ // Sorry about the double negative.
45+ if ! os .IsNotExist (err ) {
46+ defaultWorkspace = fmt .Sprintf ("%s-1" , defaultWorkspace )
47+ }
48+ usrCfg .Workspace = defaultWorkspace
3949 }
4050
4151 apiCfg := config .NewEmptyAPIConfig ()
You can’t perform that action at this time.
0 commit comments