-
Notifications
You must be signed in to change notification settings - Fork 799
在 macOS 上添加启动脚本的后缀 .command
#4927
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
base: main
Are you sure you want to change the base?
Conversation
| extension.png=Image File | ||
| extension.ps1=Windows PowerShell Script | ||
| extension.sh=Shell Script | ||
| extension.command=macOS Command Script |
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.
| extension.command=macOS Command Script | |
| extension.command=macOS Shell Script |
| extension.png=圖片檔案 | ||
| extension.ps1=PowerShell 指令碼 | ||
| extension.sh=Bash 指令碼 | ||
| extension.command=macOS Command 指令碼 |
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.
| extension.command=macOS Command 指令碼 | |
| extension.command=macOS Shell 指令碼 |
| extension.png=图片文件 | ||
| extension.ps1=PowerShell 脚本 | ||
| extension.sh=Bash 脚本 | ||
| extension.command=macOS Command 脚本 |
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.
| extension.command=macOS Command 脚本 | |
| extension.command=macOS Shell 脚本 |
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.
Pull request overview
This pull request adds support for the .command file extension for launch scripts on macOS. The .command extension is natively recognized by macOS as executable and can be double-clicked in Finder to run, making it more user-friendly than .sh files which require terminal access or explicit permission changes.
Key Changes:
- Extended script validation logic to accept
.commandextension alongside.shfor non-Windows platforms - Added
.commandoption to the file chooser dialog specifically for macOS users - Added localization strings for "macOS Shell Script" in English, Simplified Chinese, and Traditional Chinese
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java | Updated validation logic to accept both 'sh' and 'command' extensions for Unix-like systems, with corresponding error message update |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java | Added .command extension filter option to file chooser dialog for macOS users, positioned before other options for better discoverability |
| HMCL/src/main/resources/assets/lang/I18N.properties | Added English localization string for .command file extension |
| HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | Added Simplified Chinese localization string for .command file extension |
| HMCL/src/main/resources/assets/lang/I18N_zh.properties | Added Traditional Chinese localization string for .command file extension |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| else if (!isWindows && !scriptExtension.equals("sh")) | ||
| throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh' or 'ps1' in macOS/Linux"); | ||
| else if (!isWindows && !(scriptExtension.equals("sh") || scriptExtension.equals("command"))) | ||
| throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh', 'ps1' or 'command' in macOS/Linux"); |
Copilot
AI
Dec 9, 2025
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.
The error message states that the extension should be 'sh', 'ps1' or 'command' in macOS/Linux, but this error is only thrown when usePowerShell is false (line 609). This means if we reach this error, the extension is definitely NOT 'ps1', making the mention of 'ps1' in the error message confusing or misleading to users.
Note: This is a pre-existing issue also present in the Windows error message on line 611. Consider removing 'ps1' from both error messages, or restructuring the validation logic to provide clearer error messages.
Close #4925
语言文件可能需要帮助