|
@@ -105,11 +105,14 @@ pub struct Env {
|
|
|
/// The APPDIR environment variable.
|
|
|
#[cfg(target_os = "linux")]
|
|
|
pub appdir: Option<std::ffi::OsString>,
|
|
|
+ /// The command line arguments of the current process.
|
|
|
+ pub args: Vec<String>,
|
|
|
}
|
|
|
|
|
|
#[allow(clippy::derivable_impls)]
|
|
|
impl Default for Env {
|
|
|
fn default() -> Self {
|
|
|
+ let args = std::env::args().skip(1).collect();
|
|
|
#[cfg(target_os = "linux")]
|
|
|
{
|
|
|
let env = Self {
|
|
@@ -117,6 +120,7 @@ impl Default for Env {
|
|
|
appimage: std::env::var_os("APPIMAGE"),
|
|
|
#[cfg(target_os = "linux")]
|
|
|
appdir: std::env::var_os("APPDIR"),
|
|
|
+ args,
|
|
|
};
|
|
|
if env.appimage.is_some() || env.appdir.is_some() {
|
|
|
// validate that we're actually running on an AppImage
|
|
@@ -139,7 +143,7 @@ impl Default for Env {
|
|
|
}
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
|
{
|
|
|
- Self {}
|
|
|
+ Self { args }
|
|
|
}
|
|
|
}
|
|
|
}
|