7878//! let app_name = "the-app";
7979//! let app_path = "C:\\path\\to\\the-app.exe";
8080//! let args = &["--minimized"];
81- //! let auto = AutoLaunch::new(app_name, app_path, args);
81+ //! let enable_mode = WindowsEnableMode::CurrentUser;
82+ //! let auto = AutoLaunch::new(app_name, app_path, args, enable_mode);
8283//!
8384//! // enable the auto launch
8485//! auto.enable().is_ok();
@@ -182,7 +183,8 @@ mod windows;
182183/// # let app_name = "the-app";
183184/// # let app_path = "/path/to/the-app";
184185/// # let args = &["--minimized"];
185- /// AutoLaunch::new(app_name, app_path, args);
186+ /// # let enable_mode = WindowsEnableMode::CurrentUser;
187+ /// AutoLaunch::new(app_name, app_path, args, enable_mode);
186188/// # }
187189/// ```
188190#[ derive( Debug , Clone , PartialEq , Eq ) ]
@@ -193,15 +195,15 @@ pub struct AutoLaunch {
193195 /// The application executable path (absolute path will be better)
194196 pub ( crate ) app_path : String ,
195197
198+ /// Args passed to the binary on startup
199+ pub ( crate ) args : Vec < String > ,
200+
196201 #[ cfg( target_os = "macos" ) ]
197202 /// Whether use Launch Agent for implement or use AppleScript
198203 pub ( crate ) use_launch_agent : bool ,
199204
200205 #[ cfg( windows) ]
201206 pub ( crate ) enable_mode : WindowsEnableMode ,
202-
203- /// Args passed to the binary on startup
204- pub ( crate ) args : Vec < String > ,
205207}
206208
207209impl AutoLaunch {
@@ -340,9 +342,6 @@ impl AutoLaunchBuilder {
340342 ///
341343 /// - `app_name` is none
342344 /// - `app_path` is none
343- ///
344- /// ## Panics
345- ///
346345 /// - Unsupported target OS
347346 pub fn build ( & self ) -> Result < AutoLaunch > {
348347 let app_name = self . app_name . as_ref ( ) . ok_or ( Error :: AppNameNotSpecified ) ?;
0 commit comments