pub fn shim_executable() -> Fallible<PathBuf> {
    // if VOLTA_SHIM is set, try that first
    // (not documented yet, as it's currently only used for testing)
    if let Some(shim_location) = env::var_os("VOLTA_SHIM") {
        return Ok(shim_location.into());
    }

    // default location for the shim executable
    // (this will be the case for the majority of installs)
    let default_shim_executable = volta_home()?.join("shim");
    if default_shim_executable.exists() {
        return Ok(default_shim_executable);
    }

    // when an RPM is installed as root, the shim will be here for non-root users
    // (this will be the case for some managed installs)
    let rpm_shim_executable = PathBuf::from("/usr/bin/volta-lib/shim");
    if rpm_shim_executable.exists() {
        return Ok(rpm_shim_executable);
    }

    Err(ErrorDetails::ShimExecutableNotFound.into())
}
// check that it exists - if not, check some other locations
check that it exists - if not, check some other locations
check that it exists - if not check some other locations
pub fn shim_executable() -> Fallible<PathBuf> {
    // if VOLTA_SHIM is set, try that first
    // (not documented yet, as it's currently only used for testing)
    if let Some(shim_location) = env::var_os("VOLTA_SHIM") {
        return Ok(shim_location.into());
    }
    // default location for the shim executable
    // (this will be the case for the majority of installs)
    let default_shim_executable = volta_home()?.join("shim");
    if default_shim_executable.exists() {
        return Ok(default_shim_executable);
    }
    // when an RPM is installed as root, the shim will be here for non-root users
    // (this will be the case for some managed installs)
    let rpm_shim_executable = PathBuf::from("/usr/bin/volta-lib/shim");
    if rpm_shim_executable.exists() {
        return Ok(rpm_shim_executable);
    }
    Err(ErrorDetails::ShimExecutableNotFound.into())
}
pub fn shim_executable ( ) -> Fallible < PathBuf > { // if VOLTA_SHIM is set, try that first // (not documented yet, as it's currently only used for testing) if let Some ( shim_location ) = env :: var_os ( " " ) { return Ok ( shim_location . into ( ) ) ; } // default location for the shim executable // (this will be the case for the majority of installs) let default_shim_executable = volta_home ( ) ? . join ( " " ) ; if default_shim_executable . exists ( ) { return Ok ( default_shim_executable ) ; } // when an RPM is installed as root, the shim will be here for non-root users // (this will be the case for some managed installs) let rpm_shim_executable = PathBuf :: from ( " " ) ; if rpm_shim_executable . exists ( ) { return Ok ( rpm_shim_executable ) ; } Err ( ErrorDetails :: ShimExecutableNotFound . into ( ) ) }
check that it exists - if not, check some other locations
check that it exists - if not check some other locations