mirror of
https://github.com/forkless/NotAlterra.git
synced 2026-08-16 08:36:37 +02:00
v0.4.0 phase 1: stale config cleanup, --help flag, gitignore
This commit is contained in:
@@ -4,6 +4,9 @@
|
|||||||
/samples
|
/samples
|
||||||
*.log
|
*.log
|
||||||
config.ini
|
config.ini
|
||||||
|
/backups/
|
||||||
|
/logs/
|
||||||
|
NotAlterra_LICENSE_ACCEPTED
|
||||||
.deepseek
|
.deepseek
|
||||||
/builds/
|
/builds/
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ pub fn accept_disclaimer() -> std::io::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Path to the stale `config.ini` from v0.3.0 and earlier.
|
||||||
|
pub fn stale_config_path() -> PathBuf {
|
||||||
|
exe_dir().join("config.ini")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove the stale `config.ini` if it exists. Returns `true` if removed.
|
||||||
|
pub fn cleanup_stale_config() -> bool {
|
||||||
|
let path = stale_config_path();
|
||||||
|
if path.exists() {
|
||||||
|
std::fs::remove_file(&path).ok();
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Return the directory containing the running executable.
|
/// Return the directory containing the running executable.
|
||||||
pub fn exe_dir() -> PathBuf {
|
pub fn exe_dir() -> PathBuf {
|
||||||
std::env::current_exe()
|
std::env::current_exe()
|
||||||
|
|||||||
+14
@@ -39,6 +39,15 @@ const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
|
|||||||
/// Entry point — parses args, loads config, and starts the TUI loop.
|
/// Entry point — parses args, loads config, and starts the TUI loop.
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
for arg in std::env::args().skip(1) {
|
for arg in std::env::args().skip(1) {
|
||||||
|
if arg == "--help" || arg == "-h" {
|
||||||
|
println!("notalterra {}", VERSION);
|
||||||
|
println!("Subnautica 2 save-file manager — cross-platform terminal application.");
|
||||||
|
println!();
|
||||||
|
println!("Usage: notalterra [--version | --help]");
|
||||||
|
println!();
|
||||||
|
println!("Run with no arguments to start the interactive terminal UI.");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
if arg == "--version" || arg == "-v" {
|
if arg == "--version" || arg == "-v" {
|
||||||
println!("notalterra {}", VERSION);
|
println!("notalterra {}", VERSION);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -148,6 +157,11 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>) -> Result<()> {
|
|||||||
result in incomplete, corrupt, or overwritten save files.",
|
result in incomplete, corrupt, or overwritten save files.",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// Clean up stale config.ini from v0.3.0 and earlier
|
||||||
|
if crate::config::cleanup_stale_config() {
|
||||||
|
guard::log_action("MIGRATE", "old config.ini removed", "SAFE", &app.log_path)?;
|
||||||
|
}
|
||||||
|
|
||||||
// Quick check of common save locations (current user only, no profile scans)
|
// Quick check of common save locations (current user only, no profile scans)
|
||||||
if app.save_folder.is_none() {
|
if app.save_folder.is_none() {
|
||||||
if let Some(path) = discovery::quick_discover() {
|
if let Some(path) = discovery::quick_discover() {
|
||||||
|
|||||||
Reference in New Issue
Block a user