get_current_executable

Function get_current_executable 

Source
pub fn get_current_executable() -> Result<PathBuf>
Expand description

Gets the path to the current executable file.

This function retrieves the filesystem path to the currently running executable, which is needed for the self-update process to know which file to replace. It wraps Rust’s std::env::current_exe() with proper error handling.

§Returns

Returns the PathBuf to the current executable file.

§Errors

Returns an error if the current executable path cannot be determined, which may happen in some restricted execution environments or if the executable has been deleted after startup.

§Examples

use image_optimizer::updater::executable_manager::get_current_executable;

let exe_path = get_current_executable()?;
println!("Current executable: {}", exe_path.display());