From 93e47518a430c1b33cd962d071e30794ad1d3ae4 Mon Sep 17 00:00:00 2001
From: zanbin168 <zanbin168@qq.com>
Date: 星期二, 16 五月 2023 23:10:12 +0800
Subject: [PATCH] update
---
update.go | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/update.go b/update.go
index 4a0109f..726b00c 100644
--- a/update.go
+++ b/update.go
@@ -103,12 +103,17 @@
// Install binary to replace the current version.
func (m *Manager) Install(path string) error {
- bin, err := os.Executable()
+ executablePath, err := os.Executable()
+ if err != nil {
+ return errors.Wrapf(err, "looking up path of %q", m.Command)
+ }
+ absolutePath, err := filepath.Abs(executablePath)
if err != nil {
return errors.Wrapf(err, "looking up path of %q", m.Command)
}
- dir := filepath.Dir(bin)
+ dir := strings.TrimSuffix(absolutePath, "/"+m.Command)
+
return m.InstallTo(path, dir)
}
--
Gitblit v1.8.0