Skip to content
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

Fix permissions bug with self-update on windows #33

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- `rokit self-update` will no longer encounter an OS error on Windows systems

## `0.1.3` - June 18th, 2024

### Changed
Expand Down
9 changes: 8 additions & 1 deletion lib/storage/tool_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ impl ToolStorage {
// with the OS killing the current executable when its overwritten.
if rokit_link_existed {
let temp_file = tempfile::tempfile()?;
let temp_path = temp_file.path()?;
let mut temp_path = temp_file.path()?;
#[cfg(windows)]
{
// Windows raises an OS error if the current binary is
// renamed to a file name without a .exe extension. So to
// avoid that, we add the extension.
temp_path.set_extension("exe");
}
trace!(
?temp_path,
"moving existing Rokit binary to temporary location"
Expand Down