A simple installation app creator for your Windows app.
Takes the bytes that make up your binary and store it inside the installer binary, then it writes the file down in a requested location.
how to use:
- First create a ./installer/installer.rs
file in your crates root directory.
- Add the binary to your Cargo.toml
as such:
```toml
[package]
name = "demo-app"
version = "1.0.0"
edition = "2021"
[[bin]] name = "demo_app" path = "src/main.rs"
[[bin]] name = "demoappinstaller" path = "installer/installer.rs"
[dependencies]
installerlite = "1.0.0"
- inside the `installer.rs`:
rs
use installerlite::Installer;
use std::{env, path::PathBuf};
/* Make sure your app is built first, then include it's bytes */ static EXECUTABLE: &'static [u8] = includebytes!("../target/release/demoapp.exe"); fn main() { let appname = env!("CARGOPKG_NAME");
let mut installer = Installer::new(
EXECUTABLE,
None, // Defaults to C:\Program Files (x86)
app_name.to_string(),
);
/* Support for pre and post install custom functions */
installer.add_pre_install_function(Box::from(|| {
println!("STARTING INSTALLATION HEHE");
let console_output = "STARTING INSTALLATION HEHE".to_owned();
return console_output;
}));
/* Start the installer, maybe handle error cases */
installer.start().expect("Installation somehow failed");
} ```