diff --git a/README.md b/README.md index 2774042..036dc84 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ path change needed for legacy or modern Steam installs. > [!IMPORTANT] > If the tool cannot locate your `SaveGames` folder, you can manually -> override the path by editing the `last_path` field in `config.ini`. +> override the path by editing the `save_path` field in `config.ini`. Backups are stored in `NotAlterra_Backups\` alongside the binary. @@ -126,8 +126,8 @@ Created automatically next to the binary: ```ini [alterra] -last_path = C:\Users\...\Subnautica2\Saved\SaveGames -last_scan = 2026-05-31 18:00:00 +save_path = C:\Users\...\Subnautica2\Saved\SaveGames +save_scan = 2026-05-31 18:00:00 disclaimer_accepted = true config_path = C:\Users\...\Subnautica2\Saved\Config\Windows ``` diff --git a/src/config.rs b/src/config.rs index a6814a3..17d8fa9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,8 +5,8 @@ //! //! ```ini //! [alterra] -//! last_path = C:\Users\...\Subnautica2\Saved\SaveGames -//! last_scan = 2026-05-26 19:45:22 +//! save_path = C:\Users\...\Subnautica2\Saved\SaveGames +//! save_scan = 2026-05-26 19:45:22 //! disclaimer_accepted = true //! config_path = C:\Users\...\Subnautica2\Saved\Config\Windows //! ``` @@ -20,11 +20,11 @@ use std::path::{Path, PathBuf}; #[derive(Debug, Clone, Default)] pub struct AppConfig { /// Last-known save folder (SaveGames) - pub last_path: Option, + pub save_path: Option, /// Last-known Config\Windows folder pub config_path: Option, /// Timestamp of last successful scan - pub last_scan: Option, + pub save_scan: Option, /// Whether disclaimer was accepted pub disclaimer_accepted: bool, } @@ -58,12 +58,12 @@ pub fn load_config(path: &Path) -> Result { continue; } - if let Some(val) = trimmed.strip_prefix("last_path").and_then(strip_eq) { - cfg.last_path = Some(val.to_string()); + if let Some(val) = trimmed.strip_prefix("save_path").and_then(strip_eq) { + cfg.save_path = Some(val.to_string()); } else if let Some(val) = trimmed.strip_prefix("config_path").and_then(strip_eq) { cfg.config_path = Some(val.to_string()); - } else if let Some(val) = trimmed.strip_prefix("last_scan").and_then(strip_eq) { - cfg.last_scan = Some(val.to_string()); + } else if let Some(val) = trimmed.strip_prefix("save_scan").and_then(strip_eq) { + cfg.save_scan = Some(val.to_string()); } else if let Some(val) = trimmed.strip_prefix("disclaimer_accepted").and_then(strip_eq) { cfg.disclaimer_accepted = val.trim() == "true"; } @@ -91,14 +91,14 @@ pub fn save_config(path: &Path, cfg: &AppConfig) -> Result<()> { writeln!(f, "[alterra]")?; - if let Some(ref lp) = cfg.last_path { - writeln!(f, "last_path = {lp}")?; + if let Some(ref lp) = cfg.save_path { + writeln!(f, "save_path = {lp}")?; } if let Some(ref cp) = cfg.config_path { writeln!(f, "config_path = {cp}")?; } - if let Some(ref ls) = cfg.last_scan { - writeln!(f, "last_scan = {ls}")?; + if let Some(ref ls) = cfg.save_scan { + writeln!(f, "save_scan = {ls}")?; } writeln!( f, @@ -116,7 +116,7 @@ pub fn save_config(path: &Path, cfg: &AppConfig) -> Result<()> { /// Collect key/value pairs from the old config that this tool doesn't own. fn preserved_keys(path: &Path) -> Result> { - let known = &["last_path", "config_path", "last_scan", "disclaimer_accepted"]; + let known = &["save_path", "config_path", "save_scan", "disclaimer_accepted"]; let mut out = Vec::new(); let f = fs::File::open(path)?; diff --git a/src/discovery.rs b/src/discovery.rs index dc2e16c..167373f 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -32,7 +32,7 @@ const KNOWN_PATTERNS: &[(&str, &str)] = &[ /// Search all known locations for Subnautica 2 save folders. /// /// Returns a deduplicated, ranked list. The first result is cached as -/// `last_path` in config.ini so subsequent launches skip the scan. +/// `save_path` in config.ini so subsequent launches skip the scan. pub fn discover_save_folders() -> Vec { let mut found: Vec = Vec::new(); let mut seen: std::collections::HashSet = std::collections::HashSet::new(); diff --git a/src/main.rs b/src/main.rs index 3e5bcea..f0e0610 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ impl App { let config = crate::config::load_config(&config_path)?; let log_path = guard::log_path(); - let save_folder = config.last_path.as_deref().map(PathBuf::from); + let save_folder = config.save_path.as_deref().map(PathBuf::from); let mut tui_state = tui::AppState::default(); tui_state.version = VERSION.to_string(); @@ -173,8 +173,8 @@ fn run_app(terminal: &mut Terminal) -> Result<()> { app.set_spinner(false); if let Some(first) = folders.first() { app.save_folder = Some(first.path.clone()); - app.config.last_path = Some(first.path.display().to_string()); - app.config.last_scan = Some(chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()); + app.config.save_path = Some(first.path.display().to_string()); + app.config.save_scan = Some(chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()); crate::config::save_config(&app.config_path, &app.config)?; refresh_stats(&mut app.tui_state, app.save_folder.as_deref()); true @@ -353,8 +353,8 @@ fn action_locate_saves(terminal: &mut Terminal, app: &mut App) -> // Cache the first result if let Some(first) = folders.first() { app.save_folder = Some(first.path.clone()); - app.config.last_path = Some(first.path.display().to_string()); - app.config.last_scan = Some(chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()); + app.config.save_path = Some(first.path.display().to_string()); + app.config.save_scan = Some(chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string()); crate::config::save_config(&app.config_path, &app.config)?; } @@ -1011,7 +1011,7 @@ fn ensure_save_folder(_terminal: &mut Terminal, app: &mut App) -> let folders = discovery::discover_save_folders(); if let Some(first) = folders.first() { app.save_folder = Some(first.path.clone()); - app.config.last_path = Some(first.path.display().to_string()); + app.config.save_path = Some(first.path.display().to_string()); crate::config::save_config(&app.config_path, &app.config)?; refresh_stats(&mut app.tui_state, app.save_folder.as_deref()); return Ok(first.path.clone());