diff --git a/cmd/ncpt/app.go b/cmd/ncpt/app.go index 8510a18..fffe67d 100644 --- a/cmd/ncpt/app.go +++ b/cmd/ncpt/app.go @@ -62,13 +62,14 @@ func (a *AppState) initialize() error { flag.Parse() a.Parms = flag.Args() - if err := a.validateConfDir(); err != nil { - return err - } a.QuestsDir = a.ConfDir + "/quests" a.ShipsDir = a.ConfDir + "/ships" a.HoldsDir = a.ConfDir + "/holds" + if err := a.validateConfDir(); err != nil { + return err + } + // Figure out what 'mode' we're running in if *validateQuest != "" { a.Mode = MODE_VALIDATE_QUEST @@ -129,15 +130,19 @@ func (a *AppState) validateConfDir() error { ans := cli.PromptWDefault(fmt.Sprintf("Create configuration directories (%s)? [n]", a.ConfDir), "n") if strings.ToLower(ans) == "y" { if err := os.Mkdir(a.ConfDir, 0700); err != nil { + cli.PrintErr("Error creating main configuration directory") return err } if err := os.Mkdir(a.QuestsDir, 0700); err != nil { + cli.PrintErr(fmt.Sprintf("Error creating Quests directory (%s)", a.QuestsDir)) return err } if err := os.Mkdir(a.ShipsDir, 0700); err != nil { + cli.PrintErr(fmt.Sprintf("Error creating Ships directory (%s)", a.ShipsDir)) return err } if err := os.Mkdir(a.HoldsDir, 0700); err != nil { + cli.PrintErr(fmt.Sprintf("Error creating Holds directory (%s)", a.HoldsDir)) return err } } else {