Commit b3e12e6
Fix Linux desktop integration: holistic sync, wildcard MIME resolution
Three interconnected fixes:
1. Wildcard MIME sentinel resolution (image/* -> image/x-m71 etc.)
LinuxPlatform now resolves wildcard sentinels from DesktopService at
write time: checks /usr/share/mime/globs2 for a system-known type
matching the prefix, otherwise synthesizes prefix/x-sanitized-ext.
Fixes StringIndexOutOfBoundsException in generateMimeTypeComment for
extensions that produce empty parts after sanitization.
2. Holistic desktop file synthesis
Add syncDesktopIntegration(webLinks, desktopIcon, fileTypes) to
DesktopIntegrationProvider (default delegates to individual setters).
LinuxPlatform overrides it to build the .desktop file from scratch in
one pass: all-false deletes the file; otherwise Exec is always written,
icon fields / scheme handlers / MIME types are added conditionally.
Individual setters now read current state and delegate, staying correct
when called in isolation.
3. Fix isDesktopIconPresent() and OptionsDesktop.run()
isDesktopIconPresent() now checks Name+Exec in the loaded file rather
than bare file existence, so a file present only for web links or MIME
types is not mistaken for an icon entry.
OptionsDesktop.run() gathers all three desired states then calls
syncDesktopIntegration once, eliminating order-dependent stomping.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 0d25ecf commit b3e12e6
File tree
3 files changed
+211
-136
lines changed- src/main/java/org/scijava/desktop
- options
- platform/linux
3 files changed
+211
-136
lines changedLines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
104 | 130 | | |
105 | 131 | | |
106 | 132 | | |
| |||
Lines changed: 16 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
106 | 115 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 158 | | |
167 | 159 | | |
168 | 160 | | |
| |||
0 commit comments