fix(desktop): Windows .exe install fails on non-ASCII paths (#371)#517
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
✅ Files skipped from review due to trivial changes (13)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughPrefers launching Windows .exe installers with ChangesWindows Installer Launch & Localized Release Notes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…new across locales
6cf0d71 to
21ace00
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopInstaller.kt`:
- Around line 699-705: The fallback in the catch block handling cmd start (catch
(e: IOException)) can itself throw an IOException via
Desktop.getDesktop().open(file); wrap the fallback code inside its own try-catch
so any IOException from Desktop.open or ProcessBuilder.start is caught and
logged (use Logger.w or Logger.e) instead of propagating; update the block
around Desktop.getDesktop().open(file) /
ProcessBuilder(file.absolutePath).start() in DesktopInstaller.kt to catch and
log the fallback exception, referencing the existing catch (e: IOException)
handler and the Desktop.getDesktop().open(file) and ProcessBuilder(...) calls.
In `@core/presentation/src/commonMain/composeResources/files/whatsnew/fr/16.json`:
- Around line 34-35: Add the Windows installer fix bullet to each locale's
whatsnew 16.json that is missing it: open the 16.json files for ar, bn, hi, it,
ja, ko, ru, tr, and zh-CN and append the installer-fix bullet (the same entry
present in fr/es/pl: "Le lancement de l’installateur sous Windows ne plante plus
pour les comptes dont le nom d’utilisateur contient des caractères non-ASCII ou
des noms de fichier inhabituels."), replacing it with the correct localized
translation for each language and keeping the JSON array formatting consistent
with the existing entries in those 16.json files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 80f9c53a-392a-4c6f-a01a-075f5bb657e6
📒 Files selected for processing (14)
core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopInstaller.ktcore/presentation/src/commonMain/composeResources/files/whatsnew/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ar/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/bn/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/es/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/fr/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/hi/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/it/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ja/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ko/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/pl/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ru/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/tr/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/zh-CN/16.json
| } catch (e: IOException) { | ||
| Logger.w { "Failed to launch installer via cmd start: ${e.message}, falling back to Desktop.open" } | ||
| if (Desktop.isDesktopSupported()) { | ||
| Desktop.getDesktop().open(file) | ||
| } else { | ||
| ProcessBuilder(file.absolutePath).start() | ||
| } |
There was a problem hiding this comment.
Fallback Desktop.open() can throw an uncaught IOException within the catch block.
Desktop.getDesktop().open(file) (line 702) declares throws IOException and will surface the same "Unsupported URI content" error for non-ASCII paths that motivated this fix. If cmd start somehow fails and Desktop.open also throws, the IOException escapes the catch (e: IOException) block unhandled — no log is emitted and the coroutine fails silently. Wrap the fallback in its own try-catch:
🛡️ Proposed fix
} catch (e: IOException) {
Logger.w { "Failed to launch installer via cmd start: ${e.message}, falling back to Desktop.open" }
- if (Desktop.isDesktopSupported()) {
- Desktop.getDesktop().open(file)
- } else {
- ProcessBuilder(file.absolutePath).start()
+ try {
+ if (Desktop.isDesktopSupported()) {
+ Desktop.getDesktop().open(file)
+ } else {
+ ProcessBuilder(file.absolutePath).start()
+ }
+ } catch (fallbackEx: IOException) {
+ Logger.e { "Fallback installer launch also failed: ${fallbackEx.message}" }
+ throw fallbackEx
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch (e: IOException) { | |
| Logger.w { "Failed to launch installer via cmd start: ${e.message}, falling back to Desktop.open" } | |
| if (Desktop.isDesktopSupported()) { | |
| Desktop.getDesktop().open(file) | |
| } else { | |
| ProcessBuilder(file.absolutePath).start() | |
| } | |
| } catch (e: IOException) { | |
| Logger.w { "Failed to launch installer via cmd start: ${e.message}, falling back to Desktop.open" } | |
| try { | |
| if (Desktop.isDesktopSupported()) { | |
| Desktop.getDesktop().open(file) | |
| } else { | |
| ProcessBuilder(file.absolutePath).start() | |
| } | |
| } catch (fallbackEx: IOException) { | |
| Logger.e { "Fallback installer launch also failed: ${fallbackEx.message}" } | |
| throw fallbackEx | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopInstaller.kt`
around lines 699 - 705, The fallback in the catch block handling cmd start
(catch (e: IOException)) can itself throw an IOException via
Desktop.getDesktop().open(file); wrap the fallback code inside its own try-catch
so any IOException from Desktop.open or ProcessBuilder.start is caught and
logged (use Logger.w or Logger.e) instead of propagating; update the block
around Desktop.getDesktop().open(file) /
ProcessBuilder(file.absolutePath).start() in DesktopInstaller.kt to catch and
log the fallback exception, referencing the existing catch (e: IOException)
handler and the Desktop.getDesktop().open(file) and ProcessBuilder(...) calls.
Closes #371
Root cause
Desktop's Windows .exe install path uses
java.awt.Desktop.getDesktop().open(file)which converts the file path to a URI internally. Paths with non-ASCII characters in the user's Windows username (Chinese, Korean, Cyrillic, etc.) or unusual filename glyphs fail URI conversion and surface asUnsupported URI content: <path>.Fix
Hand off to
ShellExecuteviacmd /c start "" "<path>"instead.starttakes the path verbatim through the system codepage and works regardless of charset. Same approachDesktopAppLauncher.launchWindowsAppalready uses to launch installed apps.Desktop.openretained as fallback ifcmditself fails (defensive — shouldn't happen on Windows).Test plan
用户/пользователь/사용자) — install any .exe from Details, no error.Summary by CodeRabbit