Skip to content

Commit 730b002

Browse files
authored
fix testbeds with argh in wasm (#22339)
# Objective - #22223 used argh in the testbed examples - this compile in wasm but crashes when running them ## Solution - Fix it like the other examples using argh
1 parent 0cc9e53 commit 730b002

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

examples/testbed/2d.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ pub struct Args {
1616
}
1717

1818
fn main() {
19+
#[cfg(not(target_arch = "wasm32"))]
1920
let args: Args = argh::from_env();
21+
#[cfg(target_arch = "wasm32")]
22+
let args: Args = Args::from_args(&[], &[]).unwrap();
2023

2124
let mut app = App::new();
2225
app.add_plugins((DefaultPlugins,))

examples/testbed/3d.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ pub struct Args {
1616
}
1717

1818
fn main() {
19+
#[cfg(not(target_arch = "wasm32"))]
1920
let args: Args = argh::from_env();
21+
#[cfg(target_arch = "wasm32")]
22+
let args: Args = Args::from_args(&[], &[]).unwrap();
2023

2124
let mut app = App::new();
2225
app.add_plugins((DefaultPlugins,))

examples/testbed/ui.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ pub struct Args {
1616
}
1717

1818
fn main() {
19+
#[cfg(not(target_arch = "wasm32"))]
1920
let args: Args = argh::from_env();
21+
#[cfg(target_arch = "wasm32")]
22+
let args: Args = Args::from_args(&[], &[]).unwrap();
2023

2124
let mut app = App::new();
2225
app.add_plugins(DefaultPlugins.set(WindowPlugin {

0 commit comments

Comments
 (0)