Conversation
|
我记得部分用户界面的显示文本貌似是 MacOS,如果有这个情况,是否应该修正大小写? |
目前 HMCL 中没有地方使用 |
There was a problem hiding this comment.
Pull Request Overview
This pull request renames all occurrences of "OS X" to "macOS" in order to align with current naming conventions. Key changes include renaming constants and keys in Java code and resource files, updating property files and shell scripts, and refactoring helper methods to support the new naming.
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java | Changed the natives map key type and updated key lookup from OperatingSystem to a string based on Mojang's naming. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/game/JavaVersionConstraint.java | Updated OS name checks from OSX to MACOS. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameJavaVersion.java | Replaced case OSX with MACOS in version handling. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/download/java/disco/DiscoJavaDistribution.java | Updated enum pairs from OSX to MACOS. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/download/java/disco/DiscoFetchJavaListTask.java | Eliminated helper methods and used updated OperatingSystem names. |
| Resource Files & Shell Script | Updated JSON keys and property files, and changed OS values in HMCLauncher.sh. |
| Various UI and utility classes | Replaced OperatingSystem.OSX constants with OperatingSystem.MACOS in dialogs, executables, and method calls. |
| HMCL/src/main/java/org/jackhuang/hmcl/java/HMCLJavaRepository.java | Refactored getAllJava method for handling MACOS differently. |
| HMCL/src/main/java/org/jackhuang/hmcl/Main.java and Launcher.java | Updated OS checks from OSX to MACOS. |
Comments suppressed due to low confidence (1)
HMCL/src/main/java/org/jackhuang/hmcl/java/HMCLJavaRepository.java:146
- The variable 'root' is undefined in this scope; consider replacing it with 'platformRoot', which is already defined, to ensure the code compiles correctly.
platformRoot = root.resolve(platform.getOperatingSystem().getMojangName() + "-" + platform.getArchitecture().getCheckedName());
|
反对在技术层面将 OS X 更名为 macOS。 目前,HMCL 在内部有数处对 OperatingSystem 的序列化 / 反序列化操作。这种技术更名并不能带来任何优势,反而可能导致潜在的 Bug。 如果仅仅是在 UI 层面做更名,这是可行的。但在代码层面直接更名 OperatingSystem 的枚举值着实欠考虑了。 |
对 更新这些这些位置是计划中的一部分,本 PR 的目的之一就是让这些问题暴露出来,解决这些隐患,增强代码的稳健性。 |
你所提到的问题已经在 #3547 中将对应问题修复。直接更名会导致日后不少版本都可能出现序列化 / 反序列化问题,不利于启动器的稳定。 我提议仅在 I18N 等语言文件中更名 OS X 到 macOS,而非直接进行破坏性更改。 |
为了稳定性,这些代码本就不该和枚举变量的名称耦合。尤其是 macOS,它具有多个序列化名称, 本 PR 已经审查并更新了 只更新 i18n 无法暴露这些隐患,无法起到预期的作用。 |
There was a problem hiding this comment.
Pull Request Overview
This PR renames all occurrences of “OS X” to “macOS” across code, scripts, and resource files to align with Apple’s current naming convention.
- Updated code references from OperatingSystem.OSX to OperatingSystem.MACOS
- Renamed JSON and shell script keys from “osx” to “macos”
- Updated i18n property keys and lookup to use “macos_arm64”
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Library.java | Changed natives map key type from OperatingSystem to String and lookup to use getMojangName() |
| JavaVersionConstraint.java | Replaced OS X enum check with MACOS |
| GameJavaVersion.java | Switched case labels from OSX to MACOS |
| DiscoJavaDistribution.java | Updated enum entries from OSX to MACOS |
| DiscoFetchJavaListTask.java | Removed helper, now using getCheckedName() directly |
| openjfx-dependencies.json | Renamed “osx-” arrays to “macos-” |
| natives.json | Renamed “osx-arm64” key to “macos-arm64” |
| I18N_*.properties (zh, zh_CN, ru, es, default) | Renamed i18n key fatal.unsupported_platform.osx_arm64 to macos_arm64 |
| HMCLauncher.sh | Changed _HMCL_OS assignment and download page cases to “macos” |
| NativePatcher.java | Updated OSX checks to MACOS |
| FXUtils.java | Replaced OSX references with MACOS |
| Controllers.java | Updated dialog key and enum check from OSX to MACOS |
| JavaManager.java | Switched platform checks and case label from OSX to MACOS |
| HMCLJavaRepository.java | Updated OSX checks to MACOS and refactored getAllJava |
| Main.java | Changed icon init condition from OSX to MACOS |
| Launcher.java | Replaced SDK translocation checks from OSX to MACOS |
Comments suppressed due to low confidence (6)
HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties:393
- The property key changed from
fatal.unsupported_platform.osx_arm64tofatal.unsupported_platform.macos_arm64. Confirm that all code references (e.g., in Controllers.java) were updated to match this new key.
fatal.unsupported_platform.macos_arm64=Hello Minecraft! Launcher 已为 Apple Silicon 平台提供支持...
HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java:97
- This lookup assumes that the
nativesmap is populated usinggetMojangName(). Ensure that map construction was updated to use the same keys, or this lookup will always fail.
if (natives != null && natives.containsKey(OperatingSystem.CURRENT_OS.getMojangName()))
HMCLCore/src/main/java/org/jackhuang/hmcl/download/java/disco/DiscoFetchJavaListTask.java:49
- Verify that
getCheckedName()returns"macos"forOperatingSystem.MACOS, matching the Disco API expectation.
params.put("operating_system", platform.getOperatingSystem().getCheckedName());
HMCL/src/main/resources/assets/openjfx-dependencies.json:80
- You renamed the key from
osx-x86_64tomacos-x86_64. Ensure that the loader reading this JSON also expects the new key, otherwise these entries will no longer be picked up.
"macos-x86_64": [
HMCL/src/main/java/org/jackhuang/hmcl/java/JavaManager.java:77
- In
getMojangJavaPlatform, theMACOSbranch returns the literal"mac-os". Ensure that this hyphenated form is intentional and matches downstream expectations.
else if (platform.getOperatingSystem() == OperatingSystem.MACOS) {
HMCL/src/main/resources/assets/HMCLauncher.sh:17
- You updated
_HMCL_OStomacoshere but other parts of the script may still referenceosx. Run a global search to ensure consistency throughout the shell script.
_HMCL_OS="macos";;
2016 年苹果已经将 OS X 重命名为 macOS,至今已经有近十年历史。
现在大多数场景都在使用 macOS 这个名称,除了
OSRestriction和Library,没有地方应该用 OS X 这个名称,我们应当重命名它来符合新的规范。