feat(app): silently register as a .dwg/.dxf handler so portable builds show in "Open with"
Installed builds already register a handler (MSI ProgIDs, the Linux
.desktop MimeType, the macOS Info.plist), but the portable .exe and the
AppImage register nothing, so they never appear in the OS "Open with"
list. Add a best-effort, idempotent runtime registration that runs
silently on a detached thread at startup:
* Windows — writes HKCU\Software\Classes\Applications\OpenCADStudio.exe
(open command + FriendlyAppName + SupportedTypes .dwg/.dxf), which is
what lists the exe in "Open with → Choose another app".
* Linux — writes a user-level .desktop pointing at the running binary
($APPIMAGE when set) and refreshes the desktop database. Skipped when
a system package already provides the desktop entry, so we never
shadow a distro install.
* macOS — no-op; .app bundles auto-register with LaunchServices.
Unlike the default-app prompt this changes no defaults and shows no UI;
it only makes the binary discoverable as a handler.
https://claude.ai/code/session_01DFVSKgViFaxEjZD2KsTdtt
This commit is contained in:
parent
a7d85fe148
commit
5ba7101022
3 changed files with 177 additions and 4 deletions
|
|
@ -1569,6 +1569,15 @@ impl OpenCADStudio {
|
|||
/// opens the primary application window.
|
||||
fn boot() -> (Self, Task<Message>) {
|
||||
use helpers::build_window_icon;
|
||||
// Silently (re)register this binary as a .dwg/.dxf handler so it appears
|
||||
// in the OS "Open with" list. Best-effort and idempotent; covers the
|
||||
// portable .exe / AppImage that no installer has registered. Detached so
|
||||
// it never delays startup.
|
||||
std::thread::spawn(|| {
|
||||
if let Err(e) = crate::io::file_association::register_as_handler() {
|
||||
eprintln!("file association: handler registration failed: {e}");
|
||||
}
|
||||
});
|
||||
let state = Self::new();
|
||||
let (id, open_task) = window::open(window::Settings {
|
||||
maximized: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue