Files
craft-libs/crates/nightly

craft-nightly

Shared nightly-v1 startup and profile-root validation, for use by desktop apps and the launcher.

Rollout contract

  • Call prepare_launch before opening any application-owned settings, cache, logs, databases, or other persistent state. Propagate the selected root to helpers that access those paths. Exit on version-only queries before opening data paths; they intentionally install no global profile.
  • Stable builds retain their existing data paths; nightly builds use the selected profile root. Do not redirect stable data into a nightly profile or use a stable root as a fallback when validation fails.
  • canonical_profile_root is the default for new native nightly profiles. Existing launcher installs may have data in the launcher's paths.data/profiles/<app> directory. Before changing the launcher to the new default, preserve those profiles: continue passing the existing validated root explicitly until a separately tested, non-destructive migration can be performed. Never overwrite a populated destination or silently abandon a populated source. Direct launches and launcher launches must agree on the selected root after migration; the Flatpak sandbox uses its own XDG data scope, not a host filesystem path passed blindly into the sandbox.
  • Nightly startup must establish stable storage boundaries before creating its root. The validator requires HOME on Unix and APPDATA/LOCALAPPDATA on Windows, and refuses invalid configured platform directories. Resolving a default nightly path is not a substitute for this validation.
  • Validate each app's actual stable paths and environment overrides, not just its package ID. Test existing stable and nightly settings, direct launch and launcher launch, overrides, literal arguments, and platform-specific storage behavior before rollout.

The validator checks the profile at startup; it is not a sandbox or a replacement for safe filesystem operations in applications. Keep launcher-side transaction and installation protections when adopting this crate. Windows uses the same safe Win32 wrapper already used by the launcher for file link identity checks.