diff --git a/CHANGELOG.md b/CHANGELOG.md index f9a13c3..31ffb6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to NotAlterra are documented in this file. ## [v0.3.2] — 2026-06-02 +### Added +- **Lightweight startup check** — on launch, the app silently checks the + current user's default save locations (`%LOCALAPPDATA%` on Windows, + Proton + XDG data on Linux). No scanning of other profiles or system + drives. If nothing is found, use **Set save folder** as before. + ### Removed - **`config.ini` eliminated entirely** — no save path, disclaimer flag, or scan timestamp is written to disk anymore. The save folder is session-only, diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 120d3c8..74d6b0e 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -84,7 +84,7 @@ Planned changes for upcoming releases, ordered by priority. | Target | Item | |--------|------| -| v0.4.0 | Extract `validate_custom_path` and `derive_ini_path` from `discovery.rs`, then remove the module | +| v0.4.0 | TBD — see GitHub issues for planned features | Items may shift between releases depending on feedback and urgency. diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index f347462..bbdd81b 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -1,10 +1,3 @@ # Known Issues -## Discovery module is deprecated - -Auto-scan for save folders (`discovery.rs`) is deprecated in favor of the -**Set save folder** menu option. The module remains for `validate_custom_path` -and `derive_ini_path` utilities. - -**Planned**: Extract the two utility functions into `config.rs`, then remove -`discovery.rs` entirely in v0.4.0. +No known issues at this time. diff --git a/src/discovery.rs b/src/discovery.rs index d209613..c7f8a63 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -1,11 +1,8 @@ //! Save-folder discovery. //! -//! **Deprecated.** Auto-scanning user profiles and system directories for -//! Subnautica 2 saves is a privacy concern. Scheduled for removal in v0.4.0. -//! Use `Set save folder` from the main menu instead to enter paths manually. -//! -//! Traverses known path patterns across user profiles and common install -//! locations to find Subnautica 2 save folders. +//! Checks the current user's default save locations — no scanning of other +//! profiles or system drives. Run at startup as a convenience; if nothing is +//! found the user enters a path manually via `Set save folder`. use std::fs; use std::path::{Path, PathBuf}; @@ -340,6 +337,55 @@ fn fixed_drives() -> Vec { drives } +/// Quick check of the current user's default save locations. +/// +/// No scanning of other profiles, no recursion into system directories. +/// Returns the first valid path found, or `None`. +/// +/// **Windows** (checked in order): +/// 1. `%LOCALAPPDATA%\Subnautica2\Saved\SaveGames` +/// +/// **Linux / Steam Deck** (checked in order): +/// 1. `~/.steam/steam/steamapps/compatdata/1962700/pfx/drive_c/users/steamuser/AppData/Local/Subnautica2/Saved/SaveGames` +/// 2. `~/.local/share/Steam/steamapps/compatdata/1962700/pfx/drive_c/users/steamuser/AppData/Local/Subnautica2/Saved/SaveGames` +/// 3. `$XDG_DATA_HOME/Subnautica2/Saved/SaveGames` (typically `~/.local/share/Subnautica2/Saved/SaveGames`) +pub fn quick_discover() -> Option { + // Primary: %LOCALAPPDATA%\Subnautica2\Saved\SaveGames (Windows) + #[cfg(target_os = "windows")] + { + if let Some(local) = dirs::data_local_dir() { + let primary = local.join("Subnautica2").join("Saved").join("SaveGames"); + if primary.exists() && has_save_files(&primary) { + return Some(primary); + } + } + } + + // Primary: Proton paths + XDG data (Linux / Steam Deck) + #[cfg(not(target_os = "windows"))] + { + if let Some(home) = dirs::home_dir() { + for rel in &[ + ".steam/steam/steamapps/compatdata/1962700/pfx/drive_c/users/steamuser/AppData/Local/Subnautica2/Saved/SaveGames", + ".local/share/Steam/steamapps/compatdata/1962700/pfx/drive_c/users/steamuser/AppData/Local/Subnautica2/Saved/SaveGames", + ] { + let candidate = home.join(rel); + if candidate.exists() && has_save_files(&candidate) { + return Some(candidate); + } + } + } + if let Some(data) = dirs::data_local_dir() { + let primary = data.join("Subnautica2").join("Saved").join("SaveGames"); + if primary.exists() && has_save_files(&primary) { + return Some(primary); + } + } + } + + None +} + // ── helpers for the TUI ────────────────────────────────────────────────── /// Validate that a manually entered path exists and contains save files. diff --git a/src/main.rs b/src/main.rs index 7a9b45e..015e922 100644 --- a/src/main.rs +++ b/src/main.rs @@ -144,6 +144,14 @@ fn run_app(terminal: &mut Terminal) -> Result<()> { result in incomplete, corrupt, or overwritten save files.", )?; + // Quick check of common save locations (current user only, no profile scans) + if app.save_folder.is_none() { + if let Some(path) = discovery::quick_discover() { + app.save_folder = Some(path); + refresh_stats(&mut app.tui_state, app.save_folder.as_deref()); + } + } + // Disclaimer flow if !crate::config::disclaimer_accepted() { match run_disclaimer(terminal, &mut app)? {