mirror of
https://github.com/forkless/NotAlterra.git
synced 2026-08-16 00:26:38 +02:00
scaffold backup dirs at startup, ensure_dir helper
This commit is contained in:
@@ -55,6 +55,11 @@ pub fn backups_config_dir() -> PathBuf {
|
||||
p
|
||||
}
|
||||
|
||||
/// Ensure a directory exists, creating all parents as needed.
|
||||
pub fn ensure_dir(path: PathBuf) {
|
||||
let _ = std::fs::create_dir_all(&path);
|
||||
}
|
||||
|
||||
/// Return the directory containing the running executable.
|
||||
pub fn exe_dir() -> PathBuf {
|
||||
std::env::current_exe()
|
||||
|
||||
@@ -156,6 +156,10 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>) -> Result<()> {
|
||||
result in incomplete, corrupt, or overwritten save files.",
|
||||
)?;
|
||||
|
||||
// Scaffold backup directory structure
|
||||
crate::config::ensure_dir(crate::config::backups_saves_dir());
|
||||
crate::config::ensure_dir(crate::config::backups_config_dir());
|
||||
|
||||
// Migrate old transaction.log into logs/ directory
|
||||
if guard::migrate_old_log() {
|
||||
guard::log_action("MIGRATE", "old transaction.log moved to logs/", "OK", &app.log_path)?;
|
||||
|
||||
Reference in New Issue
Block a user