Crates.io | gma-lite |
lib.rs | gma-lite |
version | 0.3.1 |
created_at | 2025-08-25 23:44:17.336781+00 |
updated_at | 2025-08-29 21:59:49.526656+00 |
description | Lite GMA (Garry's Mod Addon) archive reader/writer |
homepage | |
repository | https://github.com/Srlion/gma-lite |
max_upload_size | |
id | 1810304 |
size | 12,200 |
Minimal Rust library to read and write Garry's Mod Addon (.gma) archives.
crate::read
and crate::Builder
crate::GMAFile
, crate::GmaError
crate::HEADER
, crate::VERSION
use gma_lite::read;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = std::fs::read("addon.gma")?;
let entries = read(&bytes[..])?; // Vec<GMAFile>
for e in &entries {
println!("{} ({} bytes)", e.name(), e.size());
}
Ok(())
}
use gma_lite::Builder;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut b = Builder::new("My Addon", 76561197960287930);
b.set_author("you");
b.set_description("Example addon");
b.file_from_string("lua/autorun/example.lua", "print('hello from gma-lite')");
let mut out = Vec::new();
b.write_to(&mut out)?;
std::fs::write("my_addon.gma", out)?;
Ok(())
}
crate::read
-> Result<Vec<crate::GMAFile>, crate::GmaError>
crate::Builder
with write_to<W: std::io::Write>(&self, w) -> Result<(), crate::GmaError>
crate::GMAFile
, crate::GmaError
See src/lib.rs for format details and error types.
MIT