diff --git a/gpm.go b/gpm.go index bc525b6d1..69bf36a08 100644 --- a/gpm.go +++ b/gpm.go @@ -114,14 +114,16 @@ func getAppPath() bool { // Look up executable in PATH variable. appPath, _ = exec.LookPath(path.Base(os.Args[0])) // Check if run under $GOPATH/bin + if len(appPath) == 0 { fmt.Printf("ERROR: getAppPath -> Unable to indicate current execute path.\n") return false } + appPath += "/" if runtime.GOOS == "windows" { // Replace all '\' to '/'. - appPath = strings.Replace(filepath.Dir(appPath), "\\", "/", -1) + "/" + appPath = strings.Replace(filepath.Dir(appPath), "\\", "/", -1) } doc.SetAppConfig(appPath, config.AutoBackup)