-
Notifications
You must be signed in to change notification settings - Fork 625
fix vsredist check nsh #755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…table installation support
…r architecture compatibility
WalkthroughAdds an NSIS script (build/nsis-installer.nsh) implementing architecture compatibility checks and Visual C++ Redistributable detection/installation, and includes it via electron-builder.yml. The script defines checkVCRedist, checkArchitectureCompatibility, and a customInit macro for pre-install validation, download, and installation of VC++ redist when needed, excluding uninstaller builds. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant I as NSIS Installer
participant R as System Registry
participant D as Microsoft Download Server
participant V as VC++ Installer
U->>I: Start installer
I->>I: checkArchitectureCompatibility()
I->>R: Read system arch keys
R-->>I: System arch (x64/arm64/x86)
I->>I: Infer app arch (universal/x64/arm64)
alt Incompatible
I-->>U: Show incompatibility message and open URL
I-->>U: Abort
else Compatible
I->>I: Determine target redist arch
alt x86 redist not required
I-->>U: Continue installation
else Redist required
I->>R: checkVCRedist(target)
R-->>I: Present? (yes/no)
alt Present
I-->>U: Continue installation
else Missing
I-->>U: Prompt to download and install
opt User accepts
I->>D: Download vc_redist.<arch>.exe
D-->>I: File in TEMP
I->>V: Run with /install /norestart
V-->>I: Complete (exit code ignored)
I->>R: Re-check presence
R-->>I: Present? (yes/no)
alt Installed
I-->>U: Continue installation
else Failed
I-->>U: Abort
end
end
opt User declines
I-->>U: Abort
end
end
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
build/nsis-installer.nsh (2)
18-22: Consider checking both x64 and x86 redistributables for x64 architectureWhen checking for x64 architecture, the code only checks the x64 runtime registry key. However, x64 applications might also require the x86 redistributable for compatibility with 32-bit components.
Consider checking both redistributables for x64 systems:
${If} $1 == "arm64" ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\arm64" "Installed" ${Else} ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed" + ; Optionally check x86 runtime for 32-bit components on x64 systems + ; ReadRegDWORD $2 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed" ${EndIf}
108-111: Add logging for x86 skip scenarioThe code silently skips the VC++ redistributable check for x86 systems. Consider adding a log message or comment explaining why x86 is skipped.
; Don't check for x86 systems as we don't ship redist for it ${If} $2 == "x86" + ; DetailPrint "Skipping VC++ Redistributable check for x86 architecture" Goto ContinueInstall ${EndIf}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
build/nsis-installer.nsh(1 hunks)electron-builder.yml(1 hunks)
🔇 Additional comments (2)
build/nsis-installer.nsh (1)
1-159: Well-structured NSIS installer scriptThe overall implementation is well-organized with clear separation of concerns:
- Architecture detection logic is comprehensive
- User-friendly error messages with actionable guidance
- Proper fallback handling for universal packages
- Good use of NSIS macros and conditionals
electron-builder.yml (1)
61-61: LGTM! Proper integration of NSIS installer scriptThe inclusion of the custom NSIS script is correctly placed within the
nsisconfiguration section, which will enhance the Windows installer with architecture checks and VC++ redistributable handling.
Pull Request Description (中文)
你的功能请求是否与某个问题有关?请描述一下。
请对问题进行清晰扼要的描述。
完善 #752 的nsis脚本,下载vsdist时根据当前架构拼接url,而不总是x64
Summary by CodeRabbit
New Features
Chores