From 1be8cc53e8b49e1fe006517cbd8f309b7eb16ce2 Mon Sep 17 00:00:00 2001 From: Zeyad Kenawi Date: Tue, 4 Jul 2023 02:06:06 +0300 Subject: [PATCH] use $HOME/.local/bin instead of /usr/local/bin because of sudo errors --- lib/install.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/install.go b/lib/install.go index 0b728da..6ead095 100644 --- a/lib/install.go +++ b/lib/install.go @@ -19,15 +19,16 @@ const ( ) var ( + homeDir = os.Getenv("HOME") installFile = "%s" installVersion = "%s_" - binLocation = "/usr/local/bin/%s" + binLocation = "%s/.local/bin/%s" installPath = "/.%s/" installLocation = "/tmp" installedBinPath = "/tmp" ) -//Install : Install the provided version in the argument +// Install : Install the provided version in the argument func Install(url string, appversion string, assests []modal.Repo) string { /* get current user */ @@ -40,7 +41,7 @@ func Install(url string, appversion string, assests []modal.Repo) string { app := slice[1] installPath = fmt.Sprintf(installPath, app) - bin := fmt.Sprintf(binLocation, app) + bin := fmt.Sprintf(binLocation, homeDir, app) installVersion = fmt.Sprintf(installVersion, app) installFile = fmt.Sprintf(installFile, app) @@ -260,7 +261,7 @@ func GetRecentVersions() ([]string, error) { return nil, nil } -//CreateRecentFile : create a recent file +// CreateRecentFile : create a recent file func CreateRecentFile(requestedVersion string) { WriteLines([]string{requestedVersion}, installLocation+recentFile) }