Protonup-rs/libprotonup Documentation
High Level Architectural Overview
Overview
ProtonUp-rs is a tool for managing compatibility tools (like Proton, WineGE) for apps like Steam and Lutris. It handles downloading, verifying, and installing tools from GitHub repositories.
Core Components
1. Applications (apps Module)
App Enum
Represents supported applications:
- Key Methods:
default_compatibility_tool(): Returns default tool (e.g., GEProton for Steam)detect_installation_method(): Checks for Native/Flatpak installationssubfolder_for_tool(): Gets tool-specific subfolder (e.g., "runners/wine" for Lutris Wine tools)
AppInstallations Enum
Tracks installation variants:
- Key Methods:
installation_dir(): Builds full path for tool installationlist_installed_versions(): Lists installed tool versionsapp_base_dir(): Returns root directory (e.g.,~/.steam/steam)
Adding support to new tools should be a simple process. If it has a default installation folder, the existing methods should work to detect it.
2. Compatibility Tools (sources Module)
CompatTool Struct
Defines compatibility tool sources:
- Key Methods:
installation_name(): Processes version strings (e.g., "v1.5" → "dxvk-1.5")filter_asset(): Matches release assets using regex
Preconfigured Tools:
- GEProton, WineGE, Luxtorpeda, Boxtron, DXVK, etc.
Adding new tools should be a simple process. All data related to them are stored in the sources.ron file.
Functionality like templating is optional, and not necessary for all tools.
3. Release Handling (downloads Module)
Release Struct
get_download_info(): CreatesDownloadobject with URLs and hashes
Download Struct
Key Functions:
list_releases(): Fetches GitHub releasesdownload_to_async_write(): Downloads with progress tracking
4. File Operations (files Module)
Key Features:
-
Decompression: Supports
.tar.gz,.tar.xz,.tar.zst -
Directory Management:
async -
Installation:
async
5. Security (hashing Module)
Hash Verification:
pub async
- Supports SHA-256 and SHA-512
- Automatically verifies against checksum files from GitHub
Utilities
Path Expansion
expand_tilde // => "/home/user/.steam"
Constants
pub const DEFAULT_STEAM_TOOL: &str = "GEProton";
pub const DEFAULT_LUTRIS_TOOL: &str = "WineGE";
pub const USER_AGENT: &str = "protoup-rs/vX.Y.Z";
Workflow Example
-
Detect Installed Apps:
let installed = list_installed_apps.await; // e.g., [AppInstallations::Steam] -
Fetch Releases:
let releases = list_releases.await?; -
Download & Verify:
download_to_async_write.await?; hash_check_file.await?; -
Install:
unpack_file.await?;