@@ -19,8 +19,8 @@ use crate::{
1919 Dispatch , ExitRequestedEventAction , RunEvent , Runtime ,
2020 } ,
2121 sealed:: { ManagerBase , RuntimeOrDispatch } ,
22- utils:: assets:: Assets ,
2322 utils:: config:: { Config , WindowUrl } ,
23+ utils:: { assets:: Assets , Env } ,
2424 Context , Invoke , InvokeError , InvokeResponse , Manager , StateManager , Window ,
2525} ;
2626
@@ -150,14 +150,15 @@ impl<R: Runtime> GlobalWindowEvent<R> {
150150/// The path resolver is a helper for the application-specific [`crate::api::path`] APIs.
151151#[ derive( Debug , Clone ) ]
152152pub struct PathResolver {
153+ env : Env ,
153154 config : Arc < Config > ,
154155 package_info : PackageInfo ,
155156}
156157
157158impl PathResolver {
158159 /// Returns the path to the resource directory of this app.
159160 pub fn resource_dir ( & self ) -> Option < PathBuf > {
160- crate :: api:: path:: resource_dir ( & self . package_info )
161+ crate :: api:: path:: resource_dir ( & self . package_info , & self . env )
161162 }
162163
163164 /// Returns the path to the suggested directory for your app config files.
@@ -407,6 +408,7 @@ macro_rules! shared_app_impl {
407408 /// The path resolver for the application.
408409 pub fn path_resolver( & self ) -> PathResolver {
409410 PathResolver {
411+ env: self . state:: <Env >( ) . inner( ) . clone( ) ,
410412 config: self . manager. config( ) ,
411413 package_info: self . manager. package_info( ) . clone( ) ,
412414 }
@@ -432,6 +434,11 @@ macro_rules! shared_app_impl {
432434 self . manager. package_info( )
433435 }
434436
437+ /// Gets the managed [`Env`].
438+ pub fn env( & self ) -> Env {
439+ self . state:: <Env >( ) . inner( ) . clone( )
440+ }
441+
435442 /// The application's asset resolver.
436443 pub fn asset_resolver( & self ) -> AssetResolver <R > {
437444 AssetResolver {
@@ -990,6 +997,8 @@ impl<R: Runtime> Builder<R> {
990997 } ,
991998 } ;
992999
1000+ app. manage ( Env :: default ( ) ) ;
1001+
9931002 #[ cfg( feature = "system-tray" ) ]
9941003 if let Some ( system_tray) = self . system_tray {
9951004 let mut ids = HashMap :: new ( ) ;
0 commit comments