forked from 1b-agent/opencadstudio-upstream
feat(io): autosave to .sv$ recovery files (SAVETIME command) (#205)
A periodic subscription (every SAVETIME minutes — default 10, 0 disables) writes a <name>.sv$ recovery copy of each dirty, already-saved drawing at its own DWG version. Non-destructive: it never touches the original file or the dirty flag, and skips unsaved (path-less) tabs. The SAVETIME command sets/queries the interval and persists it. Recovery files (.sv$ and .bak) open through the normal Open dialog — the loader detects DWG vs DXF from the leading magic bytes, and a "Backup / Autosave" filter lists them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
54186309b2
commit
02d2764e45
7 files changed
+93
-6
No files matched your search
@@ -1501,6 +1501,27 @@ impl OpenCADStudio {
|
||||
_ => self.command_line.push_error("Requires 0 or 1"),
|
||||
}
|
||||
}
|
||||
"SAVETIME" => {
|
||||
self.command_line
|
||||
.push_output(&format!("SAVETIME = {}", self.savetime_min));
|
||||
}
|
||||
cmd if cmd.starts_with("SAVETIME ") => {
|
||||
match cmd.trim_start_matches("SAVETIME").trim().parse::<i32>() {
|
||||
Ok(v) if v >= 0 => {
|
||||
self.savetime_min = v;
|
||||
self.persist_settings_if_changed();
|
||||
let msg = if v == 0 {
|
||||
"SAVETIME set to 0 (autosave off)".to_string()
|
||||
} else {
|
||||
format!("SAVETIME set to {v} minute(s)")
|
||||
};
|
||||
self.command_line.push_output(&msg);
|
||||
}
|
||||
_ => self
|
||||
.command_line
|
||||
.push_error("Requires a non-negative number of minutes (0 = off)"),
|
||||
}
|
||||
}
|
||||
"PDSIZE" => {
|
||||
use crate::command::ValuePromptCommand;
|
||||
let c = ValuePromptCommand::new(
|
||||
|
||||
Reference in new issue
Block a user