Expand description
Core utilities shared by Winbrew.
winbrew-core owns the reusable helpers that higher layers rely on for
filesystem layout, path resolution, hashing, downloads, temp workspaces,
cancellation, and time formatting. The crate keeps those boundaries in one
place so the app, storage, engines, and CLI layers can share the same
runtime contract.
Public modules:
env: environment variable names used for root resolutionpaths: managed-root and derived directory helperstemp_workspace: repo-independent staging rootshash: checksum helpers and digest validationnetwork: download client and installer filename helpersfs: filesystem helpers used by install, update, and repair flowstime: timestamp helpers for persistence and reportingcancel: Ctrl+C handling for long-running operations
§Environment Configuration
The core crate exposes the Windows environment variable names that higher-level code uses while resolving paths.
use winbrew_core::env;
if let Ok(custom_root) = std::env::var(env::WINBREW_PATHS_ROOT) {
println!("Using custom root: {custom_root}");
}When WINBREW_PATHS_ROOT is not set, the application root is typically
derived from env::LOCALAPPDATA and expanded into the resolved path set
in crate::paths::ResolvedPaths.
Re-exports§
pub use cancel::CancellationError;pub use cancel::check;pub use cancel::init_handler;pub use cancel::is_cancelled;pub use env::LOCALAPPDATA;pub use env::WINBREW_PATHS_ROOT;pub use fs::ArchiveKind;pub use fs::FsError;pub use fs::Result as FsResult;pub use fs::atomic_write;pub use fs::atomic_write_toml_temp;pub use fs::backup_path_for;pub use fs::cleanup_path;pub use fs::extract_archive;pub use fs::extract_zip_archive;pub use fs::finalize_temp_file;pub use fs::replace_directory;pub use hash::HashError;pub use hash::Hasher;pub use hash::Result as HashResult;pub use hash::hash_algorithm;pub use hash::normalize_hash;pub use hash::verify_hash;pub use network::BoxError as NetworkBoxError;pub use network::Client;pub use network::DownloadError;pub use network::Result as NetworkResult;pub use network::build_client;pub use network::download_url_to_temp_file;pub use network::installer_filename;pub use network::is_zip_path;pub use paths::ResolvedPaths;pub use paths::cache_dir_at;pub use paths::cache_file_at;pub use paths::catalog_db_at;pub use paths::config_file_at;pub use paths::data_dir_at;pub use paths::db_dir_at;pub use paths::db_path_at;pub use paths::install_root_from_package_dir;pub use paths::log_dir_at;pub use paths::log_file_at;pub use paths::package_journal_file_at;pub use paths::pkgdb_dir_at;pub use paths::resolve_template;pub use paths::resolved_paths;pub use temp_workspace::build_temp_root;pub use temp_workspace::temp_root_base;pub use temp_workspace::temp_root_prefix;pub use time::now;pub use time::now_ms;
Modules§
- cancel
- Cancellation support for long-running CLI and workflow operations.
- env
- Shared environment variable names used by Winbrew’s path and config resolution.
- fs
- File-system helpers used by Winbrew’s configuration, download, and install flows.
- hash
- Hashing primitives and checksum policy for download and inventory flows.
- network
- paths
- Managed-root path helpers and derived directory contracts.
- temp_
workspace - Temporary workspace helpers for download and install flows.
- time
- Time helpers used by persistence and reporting code.