@@ -9,13 +9,11 @@ use std::{cell::RefCell, num::NonZero, path::PathBuf, sync::OnceLock};
99
1010use config:: * ;
1111
12- #[ cfg( feature = "python" ) ]
13- use bevy:: asset:: io:: AssetSourceBuilder ;
1412#[ cfg( not( target_arch = "wasm32" ) ) ]
1513use bevy:: log:: tracing_subscriber;
1614use bevy:: {
1715 app:: { App , AppExit } ,
18- asset:: AssetEventSystems ,
16+ asset:: { AssetEventSystems , io :: AssetSourceBuilder } ,
1917 prelude:: * ,
2018 render:: render_resource:: { Extent3d , TextureFormat } ,
2119} ;
@@ -207,7 +205,7 @@ pub fn surface_resize(graphics_entity: Entity, width: u32, height: u32) -> error
207205 } )
208206}
209207
210- fn create_app ( _config : Config ) -> App {
208+ fn create_app ( config : Config ) -> App {
211209 let mut app = App :: new ( ) ;
212210
213211 #[ cfg( not( target_arch = "wasm32" ) ) ]
@@ -232,9 +230,7 @@ fn create_app(_config: Config) -> App {
232230 ..default ( )
233231 } ) ;
234232
235- #[ cfg( feature = "python" ) ]
236- {
237- let asset_path = _config. get ( ConfigKey :: AssetRootPath ) . unwrap ( ) ;
233+ if let Some ( asset_path) = config. get ( ConfigKey :: AssetRootPath ) {
238234 app. register_asset_source (
239235 "assets_directory" ,
240236 AssetSourceBuilder :: platform_default ( asset_path, None ) ,
@@ -271,11 +267,8 @@ fn set_app(app: App) {
271267
272268/// Initialize the app, if not already initialized. Must be called from the main thread and cannot
273269/// be called concurrently from multiple threads.
274- /// asset_path is Optional because only python needs to use it.
275270#[ cfg( not( target_arch = "wasm32" ) ) ]
276- pub fn init ( config : Option < Config > ) -> error:: Result < ( ) > {
277- let config = config. unwrap_or_default ( ) ;
278-
271+ pub fn init ( config : Config ) -> error:: Result < ( ) > {
279272 setup_tracing ( ) ?;
280273 if is_already_init ( ) ? {
281274 return Ok ( ( ) ) ;
0 commit comments