Environment

Struct Environment 

Source
pub struct Environment;
Expand description

The struct Environment contains some environment-informations about the appimage. For example, you can get the values of the appimage environment variables.

Implementations§

Source§

impl Environment

Source

pub fn appdir() -> Result<String>

If the binary lies into an appimage, this method returns the appimage environment variable “APPDIR” (absolute path to AppImage file, with symlinks resolved) See AppImage documentation for more details.

Source

pub fn appimage() -> Result<String>

If the binary lies into an appimage, this method returns the appimage environment variable “APPIMAGE”. See AppImage documentation for more details.

Source

pub fn owd() -> Result<String>

If the binary lies into an appimage, this method returns the appimage environment variable “OWD”. See AppImage documentation for more details.

Source

pub fn argv0() -> Result<String>

If the binary lies into an appimage, this method returns the appimage environment variable “ARGV0”. See AppImage documentation for more details.

Source

pub fn get_path_of<S: Into<String>>(toolname: S) -> Result<PathBuf>

If the binary lies into an appimage, this method will attempt to return the full path of the given toolname.

§Example
extern crate appimage_environment;
use appimage_environment::Environment;
 
fn main() {
	println!("My examplebinary: {:?}", Environment::get_path_of("lspci"));
}
Source

pub fn get_all_bins() -> Result<Vec<PathBuf>>

This function returns all paths of binaries which are in the appropriate binary paths of the appimage. The appropriate paths can be found in PATH.

Source

pub fn get_data_path() -> Result<PathBuf>

This function returns the path of “/data” of the appimage.

Source

pub fn get_web_path() -> Result<PathBuf>

This function returns the path of “/web” of the appimage.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.