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:
parent
54186309b2
commit
02d2764e45
7 changed files with 93 additions and 6 deletions
|
|
@ -1423,6 +1423,17 @@ impl OpenCADStudio {
|
|||
iced::time::every(std::time::Duration::from_millis(300)).map(|_| Message::PollWebFonts);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let web_fonts = Subscription::none();
|
||||
// Periodic autosave to a `.sv$` recovery file (native only). SAVETIME is
|
||||
// the interval in minutes; 0 disables it.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let autosave = if self.savetime_min > 0 {
|
||||
iced::time::every(std::time::Duration::from_secs(self.savetime_min as u64 * 60))
|
||||
.map(|_| Message::AutoSave)
|
||||
} else {
|
||||
Subscription::none()
|
||||
};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let autosave = Subscription::none();
|
||||
iced::Subscription::batch([
|
||||
frames,
|
||||
history_tick,
|
||||
|
|
@ -1430,6 +1441,7 @@ impl OpenCADStudio {
|
|||
hover_dwell,
|
||||
caret_blink,
|
||||
web_fonts,
|
||||
autosave,
|
||||
event::listen_with(|ev, status, win_id| {
|
||||
use iced::event::Status;
|
||||
match ev {
|
||||
|
|
|
|||
Loading…
Reference in a new issue