diff --git a/internal/appUpdate.go b/internal/appUpdate.go index a57b3b3..68215ed 100644 --- a/internal/appUpdate.go +++ b/internal/appUpdate.go @@ -7,6 +7,7 @@ import ( "io" "net/http" "os" + "os/user" "path/filepath" "regexp" "strings" @@ -14,7 +15,6 @@ import ( util "wowtools/pkg/utilities" "github.com/google/go-github/v56/github" - "github.com/spf13/viper" ) // Get the latest version of the application from the github api @@ -91,7 +91,14 @@ func UpdateApp(appVersion string) { // can compare the two versions and see if we need to download a new version if latestVersion > appVersion { util.Log.Info("New version available, downloading...") - downloadApp(client, latestVersion, viper.GetString("retail_dir")+"Wowtools") + user, err := user.Current() + if err != nil { + util.Log.Fatalf("Error getting current user: %s", err) + } + homeDir := user.HomeDir + downloadApp(client, latestVersion, homeDir+"Downloads") + util.Log.Info("New version downloaded, please close this application and " + + "move the new version to your desired location to replace this version") } else { util.Log.Info("You are running the latest version") } diff --git a/main.go b/main.go index 84db5b8..cba9bf5 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( func main() { - const version = "5.0.0" + const version = "5.0.1" var ( logging string