From 6f79035c5c06a9baed653a7574c34e0d4088d8e0 Mon Sep 17 00:00:00 2001
From: zanbin168 <zanbin168@qq.com>
Date: 星期二, 16 五月 2023 23:19:37 +0800
Subject: [PATCH] update

---
 update.go |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/update.go b/update.go
index bed4c9e..a765f13 100644
--- a/update.go
+++ b/update.go
@@ -1,6 +1,6 @@
-// Package update provides tooling to auto-update binary releases
+// package goupdate provides tooling to auto-update binary releases
 // from GitHub based on the user's current version and operating system.
-package update
+package goupdate
 
 import (
 	"fmt"
@@ -8,6 +8,7 @@
 	"io/ioutil"
 	"net/http"
 	"os"
+	"os/exec"
 	"path/filepath"
 	"runtime"
 	"strconv"
@@ -61,7 +62,7 @@
 		return errors.Wrap(err, "opening tarball")
 	}
 
-	err = unpackit.Unpack(f, "")
+	err = unpackit.Unpack(f, dir)
 	if err != nil {
 		f.Close()
 		return errors.Wrap(err, "unpacking tarball")
@@ -103,7 +104,7 @@
 
 // Install binary to replace the current version.
 func (m *Manager) Install(path string) error {
-	bin, err := os.Executable()
+	bin, err := exec.LookPath("./" + m.Command)
 	if err != nil {
 		return errors.Wrapf(err, "looking up path of %q", m.Command)
 	}

--
Gitblit v1.8.0