reject_disclaimer: delete sentinel file on decline

Added reject_disclaimer() to config.rs that removes the NOTALTERRA_LICENSE_ACCEPTED sentinel if it exists. Called from both decline paths in run_disclaimer() — the N/n key shortcut and Enter with No selected.
This commit is contained in:
2026-06-14 00:43:16 +02:00
parent a9940f9068
commit 9e62b822e7
2 changed files with 12 additions and 0 deletions
+9
View File
@@ -50,6 +50,15 @@ pub fn accept_disclaimer() -> std::io::Result<()> {
Ok(())
}
/// Remove the disclaimer sentinel if it exists.
pub fn reject_disclaimer() -> std::io::Result<()> {
let p = sentinel_path();
if p.exists() {
std::fs::remove_file(p)?;
}
Ok(())
}
/// Path to the stale `config.ini` from v0.3.0 and earlier.
pub fn stale_config_path() -> PathBuf {
exe_dir().join("config.ini")
+3
View File
@@ -349,6 +349,7 @@ fn run_disclaimer<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Resu
}
KeyCode::Char('n') | KeyCode::Char('N') => {
guard::log_action("LICENSE", "declined", "OK", &app.log_path)?;
crate::config::reject_disclaimer()?;
return Ok(Some(false));
}
KeyCode::Esc => {
@@ -360,6 +361,8 @@ fn run_disclaimer<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Resu
guard::log_action("LICENSE", detail, "OK", &app.log_path)?;
if accepted {
crate::config::accept_disclaimer()?;
} else {
crate::config::reject_disclaimer()?;
}
return Ok(Some(accepted));
}