Skip to content

Commit

Permalink
Merge pull request #62 from 66OJ66/first_startup_fix
Browse files Browse the repository at this point in the history
First startup fix
  • Loading branch information
alphastrata authored Nov 4, 2023
2 parents 9f6a8fd + ff69dda commit cadfdb7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ default = ["ui"]
ui = []

[dependencies]
anyhow = "1.0.75"
bevy = { version = "0.11.3", features = [
"filesystem_watcher",
"dynamic_linking",
Expand Down
14 changes: 10 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ use bevy::{

use shadplay::{plugin::ShadPlayPlugin, system::config::UserConfig, utils::AppState};

fn main() -> anyhow::Result<()> {
fn main() {
let path = UserConfig::get_config_path();
// Get UserConfig for the Shadplay window dimensions, decorations toggle etc.
let user_config = UserConfig::load_from_toml(UserConfig::get_config_path())?;
let user_config = match UserConfig::load_from_toml(&path) {
Ok(config) => config,
Err(_) => {
let default_config = UserConfig::default();
let _ = default_config.save_to_toml(path);
default_config
}
};
let user_cfg_window = user_config.create_window_settings();

let mut app = App::new();
Expand Down Expand Up @@ -44,6 +52,4 @@ fn main() -> anyhow::Result<()> {
);

shadplay.run();

Ok(())
}

0 comments on commit cadfdb7

Please sign in to comment.