func UiImagePath(ui *gui.DialogUi, defaultLocation string, remote bool) (string, error) { if remote { return ui.GetFromInput("Select directory on remote server to install the VA image on", defaultLocation, "Back", "") } var location string var err error for { location, err = ui.GetPathToDirFromInput("Select directory to install the VA image on", defaultLocation, "Back", "") if err != nil { return "", err } if _, err := os.Stat(location); err == nil { break } } return location, nil }