aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,28 @@
//! Reads the owner's current home-deletion preference; existing OEM preinstalls retain their default.
use std::io;
use std::path::Path;
use akode_config::AbsolutePathBufGuard;
use akode_config::config_toml::ConfigToml;
pub(crate) fn clean_uninstall_enabled(home: &Path, preinstalled: bool) -> bool {
let contents = match std::fs::read_to_string(home.join("config.toml")) {
Ok(contents) => contents,
Err(error) if error.kind() == io::ErrorKind::NotFound => return preinstalled,
Err(_) => return false,
};
let _guard = AbsolutePathBufGuard::new(home);
let Ok(config) = toml::from_str::<ConfigToml>(&contents) else {
return false;
};
config
.desktop
.as_ref()
.and_then(|desktop| desktop.get("uninstall_codex_home"))
.map_or(preinstalled, |value| value.as_bool().unwrap_or(false))
}
#[cfg(test)]
#[path = "uninstall_policy_tests.rs"]
mod tests;