This commit is contained in:
Djkato 2023-05-10 18:53:18 +02:00
parent 4f2de451e0
commit 9068325506
2 changed files with 9 additions and 3 deletions

View file

@ -3,7 +3,13 @@ name = "installer_lite"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"
authors = ["Djkáťo <djkatovfx@gmail.com>"] authors = ["Djkáťo <djkatovfx@gmail.com>"]
license = "MIT OR Apache-2.0"
description = "A simple Windows Installer creator for your apps."
homepage = "https://github.com/djkato/installer-lite"
repository = "https://github.com/djkato/installer-lite"
readme = "README.md"
keywords = ["installer", "windows", "wrapper"]
categories = ["development-tools::build-utils", "gui", "development-tools"]
[lib] [lib]
name = "installer_lite" name = "installer_lite"
path = "src/lib.rs" path = "src/lib.rs"

View file

@ -94,12 +94,12 @@ impl App for Installer {
impl Installer { impl Installer {
fn install(&mut self) -> Result<(), Box<dyn std::error::Error>> { fn install(&mut self) -> Result<(), Box<dyn std::error::Error>> {
let app_path = self.target_path.clone() + r"\" + &self.app_name + ".exe"; let app_path = self.target_path.clone() + r"\" + &self.app_name + ".exe";
if let Ok(_) = std::fs::read(&app_path) { if std::fs::read(&app_path).is_ok() {
return Err("App already installed".into()); return Err("App already installed".into());
}; };
std::fs::create_dir_all(&self.target_path)?; std::fs::create_dir_all(&self.target_path)?;
self.installer_output += format!("\nCreating App folder: \n{}", &self.target_path).as_str(); self.installer_output += format!("\nCreating App folder: \n{}", &self.target_path).as_str();
std::fs::write(&app_path, &self.executable)?; std::fs::write(&app_path, self.executable)?;
self.installer_output += "\nCopying executable to folder"; self.installer_output += "\nCopying executable to folder";
Ok(()) Ok(())
} }