Skip to content

Use correct executable name depending on OS #4269 #4273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkg/updates/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ func (u *Updater) zipExtension() string {
return "tar.gz"
}

func (u *Updater) executableName() string {
if runtime.GOOS == "windows" {
return "lazygit.exe"
}

return "lazygit"
}

// example: https://github.com/jesseduffield/lazygit/releases/download/v0.1.73/lazygit_0.1.73_Darwin_x86_64.tar.gz
func (u *Updater) getBinaryUrl(newVersion string) string {
url := fmt.Sprintf(
Expand Down Expand Up @@ -282,16 +290,18 @@ func (u *Updater) downloadAndInstall(rawUrl string) error {
return err
}

executableName := u.executableName()

u.Log.Info("untarring tarball/unzipping zip file")
err = u.OSCommand.Cmd.New([]string{"tar", "-zxf", zipPath, "lazygit"}).Run()
err = u.OSCommand.Cmd.New([]string{"tar", "-zxf", zipPath, executableName}).Run()
if err != nil {
return err
}

// the `tar` terminal cannot store things in a new location without permission
// so it creates it in the current directory. As such our path is fairly simple.
// You won't see it because it's gitignored.
tempLazygitFilePath := "lazygit"
tempLazygitFilePath := executableName

u.Log.Infof("Path to temp binary is %s", tempLazygitFilePath)

Expand Down