Examples
Complete Application Setup
use lighty_core::{AppState, download_file, extract_archive, get_os, trace_info};
#[tokio::main]
async fn main() {
// Initialize tracing
#[cfg(feature = "tracing")]
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.init();
// Initialize AppState FIRST
let _app = AppState::new(
"com".into(),
".MyLauncher".into(),
"".into()
)?;
trace_info!("Application initialized");
trace_info!("Running on: {:?}", get_os());
// Get launcher directory
let launcher_dir = AppState::get_project_dirs();
trace_info!("Data dir: {:?}", launcher_dir.data_dir());
Ok(())
}Download and Extract Workflow
Platform-Specific Logic
Concurrent Downloads
Error Handling Patterns
Testing AppState
Integration Example
See Also
Last updated