fix crash when saving config before user dir exists
This commit is contained in:
parent
509b577aaa
commit
f0b878e93d
3 changed files with 17 additions and 5 deletions
|
@ -3,6 +3,7 @@ Game store page: https://crispypin.itch.io/marble-machinations
|
|||
|
||||
## [unreleased]
|
||||
### fixed
|
||||
- crash when saving config if no user dir exists
|
||||
- keybindings activated even when typing in a text field, making especially renaming blueprints difficult
|
||||
- after removing a binding that was a superset of another, the remaining one did not stop being blocked by the removed ones additional modifiers until another binding was added or edited
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -9,12 +9,17 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
|||
- engine tests
|
||||
- blag post about marble movement logic?
|
||||
### bugs
|
||||
|
||||
- input tiles still consume input when their marble creation is blocked
|
||||
- Shift+A and A+Shift conflict
|
||||
- rigt side grid rendering broken
|
||||
### features
|
||||
#### 0.3.x
|
||||
- more levels
|
||||
- packet routing?
|
||||
- game of life sim (width;height;steps;grid -> grid)
|
||||
- show level name in end popup
|
||||
- hide timing debug info by default
|
||||
- shrink button
|
||||
#### 0.4.0
|
||||
- UI layout engine
|
||||
- global scale setting
|
||||
|
@ -26,6 +31,7 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
|||
- button + binding to flip selection that is being pasted
|
||||
- accessibility
|
||||
- background colour setting (requires color picker => after UI rework)
|
||||
- light theme for UI
|
||||
- hotkeys for everything (no mouse needed to play)
|
||||
- menu navigation (requires UI rework)
|
||||
- speed up/down
|
||||
|
@ -42,7 +48,7 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
|||
- show histograms
|
||||
- author name in solutions and blueprints
|
||||
### undecided
|
||||
- option to skip (speed through with settable multiplier) first N stages, for when you are debugging something that happens in later stages
|
||||
- option to skip (speed through with settable multiplier) first N stages or cycles, for when you are debugging something that happens in later stages
|
||||
- hide some tile tools in early levels to make it less overwhelming
|
||||
- footprint score (tiles that were non-empty at any point in the run)
|
||||
- option to use 8-bit marbles?
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{read_dir, read_to_string, File},
|
||||
fs::{create_dir_all, read_dir, read_to_string, File},
|
||||
io::Write,
|
||||
};
|
||||
|
||||
|
@ -348,10 +348,15 @@ impl Game {
|
|||
}
|
||||
|
||||
fn save_config(&self) {
|
||||
_ = create_dir_all(userdata_dir());
|
||||
let path = userdata_dir().join(CONFIG_FILE_NAME);
|
||||
let json = serde_json::to_string_pretty(&self.globals.config).unwrap();
|
||||
let mut f = File::create(path).unwrap();
|
||||
f.write_all(json.as_bytes()).unwrap();
|
||||
match File::create(path) {
|
||||
Ok(mut f) => {
|
||||
_ = f.write_all(json.as_bytes());
|
||||
}
|
||||
Err(e) => println!("error saving config: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue