Expand description
r2modman-compatible profile management.
Profile installs on top of crate::install: five high-level operations
(install an extracted package, uninstall, enable, disable, and the full
download-resolve-install pipeline) that work against an arbitrary target
directory. mods.yml (modlist) is the
authoritative install record in every mode.
Two layers share the same primitives:
- Client mode (named r2modman profiles):
install_extracted,uninstall_mod,set_enabled(andenable_mod/disable_mod), andinstall_modtakebase+profile_name, computelayout::profile_dir(base, game, profile_name), and delegate to the_invariant below. The profile name is validated bylayout::validate_name. - Server mode: the
_invariants (install_extracted_in,uninstall_mod_in,set_enabled_in/enable_mod_in/disable_mod_in,install_mod_in) take atarget_dir: &Pathdirectly — there is no named r2modman profile layout;mods.ymlis the source of truth for a single mod set installed straight into the game directory.
A caller-supplied target_dir is caller-owned and expected to already be
absolute; unlike a layout profile name it is not name-validated here —
there is no layout::validate_name-equivalent
check on it, the caller is trusted to pass a real directory. Package
contents are still traversal-guarded regardless of mode:
crate::install’s ensure_safe_relative rejects any archive entry or
computed destination that would escape target_dir.
install_mod_in/install_mod
additionally take a cache_base independent of the install target:
extracted packages land under
cache::ensure_extracted(cache_base, ...),
never under target_dir.
cache_base must persist across installs — it is also the restore source
crate::install::enable_mod copies from when re-enabling a State-
tracked mod — and in server mode it must not be target_dir itself, or
cache contents would sit inside the installed mod tree.
Modules§
- cache
- Extract packages into the per-game package cache. Extract packages into the per-game package cache.
- launch
- Compute a launch invocation and stage loader files. Compute how to launch a game with a target directory’s mods applied.
- layout
- Directory layout and profile lifecycle (named r2modman profiles; client mode). Directory layout and profile lifecycle.
- modlist
- The
mods.ymlmodel and its read/write. Themods.ymlmodel and its read/write. - portability
.r2zexport/import and Thunderstore profile codes. r2modman-compatible profile portability:.r2zexport/import and shareable Thunderstore profile codes.- target
- Where an install goes: a named profile, or the game directory itself. Where an install goes.
Structs§
- Batch
Outcome - The per-item result of a batch operation.
- Install
Batch - What an install batch will install, and whose disabled state it must restore afterwards.
- Toggle
Batch - What a bulk enable or disable will do.
- Uninstall
Batch - What an uninstall batch will remove.
Enums§
- NotRemovable
- Why a recorded mod’s files cannot be removed exactly.
Functions§
- check_
removable_ batch - Every one of
namesthat cannot be removed exactly, with the reason. - disable_
mod - Disables an installed mod. See
set_enabled. - disable_
mod_ in - Disables an installed mod in
target_dir. Seeset_enabled_in. - enable_
mod - Enables an installed mod. See
set_enabled. - enable_
mod_ in - Enables an installed mod in
target_dir. Seeset_enabled_in. - ensure_
removable - Whether
full_name’s files can be removed exactly, reporting the reason when they cannot. - install_
batch - Installs every identifier in
batch, restoring protected disabled state afterwards, and reports per-item outcomes. - install_
extracted - Installs an already-extracted package into an r2modman-layout profile
(
<base>/<game>/profiles/<profile_name>). Seeinstall_extracted_in. - install_
extracted_ in - Installs an already-extracted package into
target_dir: plans the file copy, removes any copy already installed (its namespaced<route>/<ident>/folders andState-tracked files, as r2modman uninstalls before installing), applies the copy, writes the_statetracker for anyState-tracked files, and upserts themods.ymlentry. - install_
mod - Installs a mod and its full dependency closure into an r2modman-layout
profile, using
baseas both the profile base and the package cache base (matching this pipeline’s pre-existing behavior). Seeinstall_mod_in. - install_
mod_ in - Installs one mod and its dependency closure, protecting the disabled state of
every recorded mod it did not name. See
install_batch. - mod_
entry_ from_ version - Builds a
ProfileModfrom a ThunderstoreVersion, applying the same defaults r2modman uses for a Thunderstore install (fromThunderstoreCombo):manifestVersion=1,gameVersion="0",networkMode="both",packageType="other",installMode="managed". - plan_
install_ batch - Plans an install batch against
target_dir’s current record. - plan_
set_ enabled_ batch - Plans a bulk enable or disable.
namesofNonemeans every recorded mod. - plan_
uninstall_ batch - Plans an uninstall, refusing before anything is mutated.
- reapply_
batch_ disabled - Re-disables everything
batchprotects, after the installs have run. - set_
enabled - Enables or disables an installed mod in an r2modman-layout profile. See
set_enabled_in. - set_
enabled_ batch - Applies
batch, reporting per-item outcomes. - set_
enabled_ in - Enables or disables an installed mod in
target_dir: applies the on-disk file toggle through the install layer, then flipsenabledinmods.yml. Errors if the mod is not present intarget_dir. - uninstall_
batch - Removes everything
batchnames, loaders last, reporting per-item outcomes. - uninstall_
mod - Uninstalls a mod from an r2modman-layout profile. See
uninstall_mod_in. - uninstall_
mod_ in - Uninstalls a mod from
target_dir: removes itsmods.ymlentry, reconciles the on-disk namespaced folders against the remaining set (so only this mod’s folders are removed), and removes itsState-tracked payload files along with its_statefile.