A Rust library for building and maintaining World of Warcraft SharedMedia addons.
It manages data.lua, generates loader.lua and .toc, converts supported media formats into WoW-compatible outputs, and keeps the addon directory in a consistent state through a small stateless API.
Third-party Lua dependencies are embedded from a pinned vendor snapshot. Normal builds and releases use the tracked snapshot in vendor.lock.json; maintainers refresh upstream dependencies explicitly with a separate workflow.
[dependencies]
wow-sharedmedia = "0.2"Requires Rust 1.95+ (edition 2024).
use std::path::Path;
use wow_sharedmedia::{
ensure_addon_dir, import_media, read_data, ImportOptions, MediaType, DEFAULT_MAX_BACKUPS,
};
fn main() -> Result<(), wow_sharedmedia::Error> {
// The addon name is derived from the folder path.
// "!!!MyMedia" sorts to top in the addon list;
// "MyMedia" works too.
let addon_dir = Path::new("AddOns/MyMedia");
ensure_addon_dir(addon_dir, DEFAULT_MAX_BACKUPS)?;
let source = Path::new("assets/my-statusbar.png");
let result = import_media(
addon_dir,
ImportOptions::new(MediaType::Statusbar, "My Statusbar", source),
DEFAULT_MAX_BACKUPS,
)?;
println!("Imported {} as {}", result.entry.key, result.entry.file);
let data = read_data(addon_dir)?;
println!("{} entries registered", data.entries.len());
Ok(())
}| Media type | Accepted input | Stored output |
|---|---|---|
statusbar |
.tga, .png, .webp, .jpg, .jpeg, .blp |
.tga |
background |
.tga, .png, .webp, .jpg, .jpeg, .blp |
.tga |
border |
.tga, .png, .webp, .jpg, .jpeg, .blp |
.tga |
font |
.ttf, .otf |
original font file |
sound |
.ogg, .mp3, .wav |
.ogg |
The crate treats data.lua as the single source of truth.
Every write operation follows the same model:
- Ensure the addon directory and static templates exist
- Read the current registry state from
data.lua - Apply the requested mutation
- Write the updated registry back to disk
This keeps the runtime model small, deterministic, and easy to integrate into higher-level tools.
The addon name is derived from the folder path β no hardcoding required.
| Folder name | TOC file | TOC title |
|---|---|---|
MyMedia |
MyMedia.toc |
MyMedia |
!!!MyMedia |
!!!MyMedia.toc |
MyMedia |
CoolTextures |
CoolTextures.toc |
CoolTextures |
Leading ! characters are stripped from the title automatically.
MyMedia/ # or !!!MyMedia β both work
βββ MyMedia.toc # or !!!MyMedia.toc
βββ data.lua
βββ loader.lua
βββ libraries/
β βββ LibStub/LibStub.lua
β βββ CallbackHandler-1.0/CallbackHandler-1.0.lua
β βββ LibSharedMedia-3.0/
β βββ LibSharedMedia-3.0.lua
β βββ lib.xml
βββ media/
βββ background/
βββ border/
βββ font/
βββ sound/
βββ statusbar/
- Contributing β development setup, commit conventions, and PR expectations
- Release Process β how releases are automated and published to crates.io