feat(packaging): open files from argv, ship Windows MSI installer (#36)
Cross-platform prerequisite for OS-level file associations: the boot task now consumes `std::env::args_os().nth(1)` as a path and dispatches `Message::OpenRecent` for it. Flag-style args (starting with `-`) are ignored, and `OpenRecent` already does the file-existence check, so a bogus path lands as a clean command-line error instead of a panic. Linux: the AppImage's desktop entry adds `image/vnd.dwg` alongside the existing `image/vnd.dxf` MIME type and grows a `%f` placeholder in `Exec=` so the launcher forwards the picked file path. Once the AppImage is integrated with the system (xdg-mime / AppImageLauncher), double-clicking a .dwg / .dxf opens it in Open CAD Studio. Windows: new `packaging/windows/main.wxs` defines an MSI installer — per-machine install to `Program Files\Open CAD Studio`, Start Menu shortcut, `MajorUpgrade` so newer MSIs replace older ones, and a single ProgID `OpenCADStudio.Drawing` that owns both `.dwg` and `.dxf` and launches the exe with the file as `argv[1]`. The icon is pulled from the SVG logo, converted to multi-resolution ICO at build time with the runner's pre-installed ImageMagick. CI now also runs `candle` / `light` (WiX Toolset 3, pre-installed on `windows-latest`) and uploads both the bare `.exe` (portable) and `.msi` (installer) to the release. macOS Info.plist already declares the DWG / DXF UTIs; combined with the argv-handling change above, double-clicking a drawing in Finder will open it in Open CAD Studio without further packaging changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
92f368f275
commit
a0800d95c9
4 changed files with 180 additions and 7 deletions
|
|
@ -1036,7 +1036,22 @@ impl OpenCADStudio {
|
|||
Message::UpdateCheckResult,
|
||||
);
|
||||
let focus_cmd = s.focus_cmd_input();
|
||||
(s, Task::batch([open_main, check_update, focus_cmd]))
|
||||
// Open a file path passed on the command line. Used by the
|
||||
// OS file association: double-clicking a .dwg in the file
|
||||
// explorer launches the binary with the file path as the
|
||||
// first positional argument. Unknown / flag-style args are
|
||||
// ignored. `Message::OpenRecent` does the existence check
|
||||
// and reports a clean error if the path is bogus.
|
||||
let cli_open: Task<Message> = std::env::args_os()
|
||||
.nth(1)
|
||||
.map(PathBuf::from)
|
||||
.filter(|p| !p.as_os_str().to_string_lossy().starts_with('-'))
|
||||
.map(|p| Task::done(Message::OpenRecent(p)))
|
||||
.unwrap_or_else(Task::none);
|
||||
(
|
||||
s,
|
||||
Task::batch([open_main, check_update, focus_cmd, cli_open]),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue