Use correct executable name depending on OS #4269
- PR Description Use correct executable name depending on OS.
When unzipping the new version, we were always extracting lazygit. On Windows, the executable is named lazygit.exe. This PR fixes that issue.
- Please check if the PR fulfills these requirements
- [x] Cheatsheets are up-to-date (run
go generate ./...) - [x] Code has been formatted (see here)
- [ ] Tests have been added/updated (see here for the integration test guide)
- [x] Text is internationalised (see here)
- [x] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
- [x] Docs have been updated if necessary
- [x] You've read through your own file changes for silly mistakes etc
I'm not really sure how to test this (and as far as I can tell there are no integration tests for this feature yet). When attempting to use the feature from a version started using go run main.go it fails when trying to replace the current executable. I'm unsure whether this is due to something go run does, or whether that is Windows specific behavior. If I remember correctly, on Windows you can't replace the current executable, so perhaps that needs dedicated support on Windows.
Fixes #4269
Is there something I can do to get this PR merged?
@KnapSac I'm okay for no test given it requires network requests and so on.
@ChrisMcD1 As a windows user, any chance you'd be able to locally test if this works?
@jesseduffield Ran the code locally, and it's certainly better!
Although it moves me from a file named error
to
The latter could 100% be user-error on my part. Although I am a windows user, I spend most of my time in WSL these days 😆
I believe that's due to the issue I mentioned, where Windows isn't able to replace the currently running executable. We'd need something like https://github.com/mitsuhiko/self-replace (but for Go), or replicate the behavior ourselves.
I don't know if there is a comparable library for Go, as this PR contains the first lines of Go I've ever written, but that would be the easiest.