From 053b50b4b92c769d00a5e8d27b0de5951c034b65 Mon Sep 17 00:00:00 2001 From: Naman Garg <155433377+naman-crabnebula@users.noreply.github.com> Date: Mon, 1 Apr 2024 06:08:46 +0530 Subject: [PATCH] fix(resource-resolver): Add pacman support for resource resolver, closes #188 (#192) * Fix pacman support for resource resolver * Add changes file * Run prettier --- .changes/add-pacman-support-resource-resolver.md | 5 +++++ crates/resource-resolver/src/lib.rs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changes/add-pacman-support-resource-resolver.md diff --git a/.changes/add-pacman-support-resource-resolver.md b/.changes/add-pacman-support-resource-resolver.md new file mode 100644 index 00000000..9cb6617b --- /dev/null +++ b/.changes/add-pacman-support-resource-resolver.md @@ -0,0 +1,5 @@ +--- +"cargo-packager-resource-resolver": patch +--- + +Added support for Pacman Packages in the Resource Resolver. diff --git a/crates/resource-resolver/src/lib.rs b/crates/resource-resolver/src/lib.rs index 8a7377f1..a3b21975 100644 --- a/crates/resource-resolver/src/lib.rs +++ b/crates/resource-resolver/src/lib.rs @@ -64,6 +64,8 @@ pub fn current_format() -> crate::Result { Ok(PackageFormat::Deb) } else if cfg!(CARGO_PACKAGER_FORMAT = "appimage") { Ok(PackageFormat::AppImage) + } else if cfg!(CARGO_PACKAGER_FORMAT = "pacman") { + Ok(PackageFormat::Pacman) } else { Err(Error::UnkownPackageFormat) } @@ -94,7 +96,7 @@ pub fn resources_dir(package_format: PackageFormat) -> Result { .ok_or_else(|| Error::ParentNotFound(exe.clone()))?; Ok(exe_dir.to_path_buf()) } - PackageFormat::Deb => { + PackageFormat::Deb | PackageFormat::Pacman => { let exe = current_exe()?; let exe_name = exe.file_name().unwrap().to_string_lossy();