Skip to content

Commit

Permalink
optional app arguments
Browse files Browse the repository at this point in the history
- allows to pass any arguments to plugins
  • Loading branch information
mrDIMAS committed Jun 7, 2024
1 parent 25334b8 commit de9b500
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
1 change: 0 additions & 1 deletion .idea/vcs.xml

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

18 changes: 5 additions & 13 deletions fyrox-impl/src/engine/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ use std::{
sync::Arc,
};

#[derive(Parser, Debug)]
#[derive(Parser, Debug, Default)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[clap(short, long, default_value = "")]
override_scene: String,
#[clap(short, long, default_value = None)]
override_scene: Option<String>,
}

/// Executor is a small wrapper that manages plugins and scripts for your game.
Expand Down Expand Up @@ -140,17 +140,9 @@ impl Executor {
let event_loop = self.event_loop;
let headless = self.headless;

let args = Args::parse();
let args = Args::try_parse().unwrap_or_default();

engine.enable_plugins(
if args.override_scene.is_empty() {
None
} else {
Some(&args.override_scene)
},
true,
Some(&event_loop),
);
engine.enable_plugins(args.override_scene.as_deref(), true, Some(&event_loop));

let mut previous = Instant::now();
let fixed_time_step = 1.0 / self.desired_update_rate;
Expand Down
2 changes: 1 addition & 1 deletion project-manager/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl ProjectWizard {
self.vcs.as_str(),
true,
);
let mut manifest_path = self
let manifest_path = self
.path
.join(&self.name)
.join("Cargo.toml")
Expand Down

0 comments on commit de9b500

Please sign in to comment.