Rename last_path→save_path, last_scan→save_scan

This commit is contained in:
2026-06-01 10:31:15 +02:00
parent 883f9eee5e
commit c0ae977159
4 changed files with 23 additions and 23 deletions
+3 -3
View File
@@ -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
```
+13 -13
View File
@@ -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<String>,
pub save_path: Option<String>,
/// Last-known Config\Windows folder
pub config_path: Option<String>,
/// Timestamp of last successful scan
pub last_scan: Option<String>,
pub save_scan: Option<String>,
/// Whether disclaimer was accepted
pub disclaimer_accepted: bool,
}
@@ -58,12 +58,12 @@ pub fn load_config(path: &Path) -> Result<AppConfig> {
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<Vec<(String, String)>> {
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)?;
+1 -1
View File
@@ -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<DiscoveredFolder> {
let mut found: Vec<DiscoveredFolder> = Vec::new();
let mut seen: std::collections::HashSet<PathBuf> = std::collections::HashSet::new();
+6 -6
View File
@@ -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<B: Backend>(terminal: &mut Terminal<B>) -> 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<B: Backend>(terminal: &mut Terminal<B>, 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<B: Backend>(_terminal: &mut Terminal<B>, 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());