From 2eb893642205bd134b2a2db60bcce2a4f0506edd Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Fri, 29 Dec 2023 19:12:49 +0100 Subject: [PATCH] [skip ci] add derive to PackageFormat and change get_current to current_format --- crates/resource-resolver/src/lib.rs | 37 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/crates/resource-resolver/src/lib.rs b/crates/resource-resolver/src/lib.rs index 7a991c99..1545f5e2 100644 --- a/crates/resource-resolver/src/lib.rs +++ b/crates/resource-resolver/src/lib.rs @@ -5,6 +5,7 @@ pub mod starting_binary; use error::Result; +#[derive(Debug, Clone, PartialEq, Eq)] pub enum PackageFormat { /// When no format is used (`cargo run`) None, @@ -22,25 +23,23 @@ pub enum PackageFormat { AppImage, } -impl PackageFormat { - /// Get the current package format - pub fn get_current() -> Self { - // sync with PackageFormat::short_name function of packager crate - if cfg!(CARGO_PACKAGER_FORMAT = "app") { - PackageFormat::App - } else if cfg!(CARGO_PACKAGER_FORMAT = "dmg") { - PackageFormat::Dmg - } else if cfg!(CARGO_PACKAGER_FORMAT = "wix") { - PackageFormat::Wix - } else if cfg!(CARGO_PACKAGER_FORMAT = "nsis") { - PackageFormat::Nsis - } else if cfg!(CARGO_PACKAGER_FORMAT = "deb") { - PackageFormat::Deb - } else if cfg!(CARGO_PACKAGER_FORMAT = "appimage") { - PackageFormat::AppImage - } else { - PackageFormat::None - } +/// Get the current package format +pub fn current_format() -> PackageFormat { + // sync with PackageFormat::short_name function of packager crate + if cfg!(CARGO_PACKAGER_FORMAT = "app") { + PackageFormat::App + } else if cfg!(CARGO_PACKAGER_FORMAT = "dmg") { + PackageFormat::Dmg + } else if cfg!(CARGO_PACKAGER_FORMAT = "wix") { + PackageFormat::Wix + } else if cfg!(CARGO_PACKAGER_FORMAT = "nsis") { + PackageFormat::Nsis + } else if cfg!(CARGO_PACKAGER_FORMAT = "deb") { + PackageFormat::Deb + } else if cfg!(CARGO_PACKAGER_FORMAT = "appimage") { + PackageFormat::AppImage + } else { + PackageFormat::None } }