Skip to content

Commit

Permalink
Fix "os error 22" when saving on Unix-like OSes (#48)
Browse files Browse the repository at this point in the history
The Rust documentation says you need to enable the write flag to use
create or truncate when writing to files, so using the create flag
without also using the write flag is probably undefined behaviour.

It seems there are still more problems preventing saving from working,
but I assume this is in the scope of #45 so I will
make no further changes.
  • Loading branch information
white-axe authored Oct 12, 2023
1 parent 242d39b commit 1bbbcc2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ impl Project {

let mut ini_file = state!()
.filesystem
.open_file("Game.ini", filesystem::OpenFlags::Create)
.open_file(
"Game.ini",
filesystem::OpenFlags::Write | filesystem::OpenFlags::Create,
)
.map_err(|e| e.to_string())?;
game_ini
.write_to(&mut ini_file)
Expand Down

0 comments on commit 1bbbcc2

Please sign in to comment.