Skip to content

Commit

Permalink
Fix permissions bug with self-update on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekkonot committed Jul 11, 2024
1 parent f69d68a commit dd8cc86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit dd8cc86

Please sign in to comment.