feat(io): .bak backup-on-save + open .bak as a supported type (#205)

- Save: overwriting an existing file first copies it to a sibling <name>.bak
  (default on; toggle with the ISAVEBAK command, persisted in settings).
- Open: .bak is a first-class type — the Open dialog lists it and the loader
  detects DWG vs DXF from the file's leading magic bytes (the extension hides
  the real format).
- File association registers .bak too, every launch (so users who associated
  earlier get it automatically): Windows via the registry; Linux via a
  high-priority shared-mime-info magic that resolves DWG/DXF content under the
  .bak extension, with the generic *.bak glob claimed only once the app is the
  default DWG handler — so it never hijacks other apps' backups.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-29 12:49:02 +03:00
1 parent b77187e672
commit 962268e16e
7 files changed
+148 -4

No files matched your search

+19
View File
@@ -1449,6 +1449,25 @@ impl OpenCADStudio {
.push_error("Requires 0 OR 1 OR MULTIPLE OR SINGLE");
}
}
"ISAVEBAK" => {
let v = if self.backup_on_save { 1 } else { 0 };
self.command_line.push_output(&format!("ISAVEBAK = {v}"));
}
cmd if cmd.starts_with("ISAVEBAK ") => {
match cmd.trim_start_matches("ISAVEBAK").trim() {
"0" => {
self.backup_on_save = false;
self.persist_settings_if_changed();
self.command_line.push_output("ISAVEBAK set to 0");
}
"1" => {
self.backup_on_save = true;
self.persist_settings_if_changed();
self.command_line.push_output("ISAVEBAK set to 1");
}
_ => self.command_line.push_error("Requires 0 or 1"),
}
}
"PDSIZE" => {
use crate::command::ValuePromptCommand;
let c = ValuePromptCommand::new(