From 508a0fc4fd6cd794607b047f8ddcaf4bb622066a Mon Sep 17 00:00:00 2001 From: Matteo Suppo Date: Tue, 3 May 2016 12:40:30 +0200 Subject: [PATCH] Find path before updating --- update.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/update.go b/update.go index 25fcdbea4..bb219212d 100644 --- a/update.go +++ b/update.go @@ -36,6 +36,14 @@ import ( ) func updateHandler(c *gin.Context) { + + path, err := osext.Executable() + + if err != nil { + c.JSON(500, gin.H{"error": err.Error()}) + return + } + var up = &updater.Updater{ CurrentVersion: version, APIURL: *updateUrl, @@ -45,14 +53,7 @@ func updateHandler(c *gin.Context) { CmdName: *appName, } - err := up.BackgroundRun() - - if err != nil { - c.JSON(500, gin.H{"error": err.Error()}) - return - } - - path, err := osext.Executable() + err = up.BackgroundRun() if err != nil { c.JSON(500, gin.H{"error": err.Error()})