Skip to main content

soar_package/
lib.rs

1//! Package format handling for the soar package manager.
2//!
3//! This crate provides functionality for detecting package formats and
4//! handling format-specific operations like desktop integration.
5//!
6//! # Supported Formats
7//!
8//! - **AppImage**: Self-contained Linux applications with embedded resources
9//! - **FlatImage**: Similar to AppImage with different internal structure
10//! - **RunImage**: Another AppImage-like format
11//! - **Wrappe**: Windows PE wrapper format
12//! - **ELF**: Standard Linux executables
13//!
14//! # Example
15//!
16//! ```no_run
17//! use std::fs::File;
18//! use std::io::BufReader;
19//! use soar_package::{get_file_type, PackageFormat, PackageError};
20//!
21//! fn detect_format(path: &str) -> Result<PackageFormat, PackageError> {
22//!     let file = File::open(path).map_err(|e| PackageError::IoError {
23//!         action: "opening file".to_string(),
24//!         source: e,
25//!     })?;
26//!     let mut reader = BufReader::new(file);
27//!     get_file_type(&mut reader)
28//! }
29//! ```
30
31pub mod error;
32pub mod formats;
33pub mod traits;
34
35pub use error::{ErrorContext, PackageError, Result};
36pub use formats::{
37    common::integrate_package, get_file_type, PackageFormat, APPIMAGE_MAGIC_BYTES, ELF_MAGIC_BYTES,
38    FLATIMAGE_MAGIC_BYTES, PNG_MAGIC_BYTES, RUNIMAGE_MAGIC_BYTES, SVG_MAGIC_BYTES,
39    WRAPPE_MAGIC_BYTES,
40};
41pub use traits::PackageExt;