summaryrefslogtreecommitdiffstats
path: root/pkg/updates
diff options
context:
space:
mode:
authorDawid Dziurla <dawidd0811@gmail.com>2019-09-15 10:49:44 +0200
committerJesse Duffield <jessedduffield@gmail.com>2019-09-24 19:01:40 +1000
commit0d25d113c9a64be71e1a1a6756a22efc6a35d01d (patch)
tree3da8456385c5a641db3dda10385fff16f07c8d40 /pkg/updates
parent7c70913e8dac9326bcd96b98755de11dd61cfd76 (diff)
download updated binary to config dir rather than /tmp
Diffstat (limited to 'pkg/updates')
-rw-r--r--pkg/updates/updates.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go
index a4ec67e27..60ba31882 100644
--- a/pkg/updates/updates.go
+++ b/pkg/updates/updates.go
@@ -3,7 +3,6 @@ package updates
import (
"encoding/json"
"fmt"
- "io/ioutil"
"net/http"
"net/url"
"os"
@@ -16,7 +15,7 @@ import (
"github.com/kardianos/osext"
- getter "github.com/jesseduffield/go-getter"
+ "github.com/jesseduffield/go-getter"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/i18n"
@@ -261,15 +260,11 @@ func (u *Updater) downloadAndInstall(rawUrl string) error {
}
g := new(getter.HttpGetter)
- tempDir, err := ioutil.TempDir("", "lazygit")
- if err != nil {
- return err
- }
- defer os.RemoveAll(tempDir)
- u.Log.Info("Temp directory is " + tempDir)
+ configDir := filepath.Dir(u.Config.GetUserConfigPath())
+ u.Log.Info("Download directory is " + configDir)
// Get it!
- if err := g.Get(tempDir, url); err != nil {
+ if err := g.Get(configDir, url); err != nil {
return err
}
@@ -284,7 +279,7 @@ func (u *Updater) downloadAndInstall(rawUrl string) error {
u.Log.Info("Binary name is " + binaryName)
// Verify the main file exists
- tempPath := filepath.Join(tempDir, binaryName)
+ tempPath := filepath.Join(configDir, binaryName)
u.Log.Info("Temp path to binary is " + tempPath)
if _, err := os.Stat(tempPath); err != nil {
return err