Skip to content

fix(game-folders): 修正非 Windows 平台上官方启动器文件夹的路径 [Claude-Opus-5.5] - #40

Merged
LuLu-ling merged 1 commit into
PCL-Community:devfrom
zhuzhi-09:fix/26-official-launcher-folder
Nov 15, 2026
Merged

LuLu-ling merged 1 commit into
PCL-Community:devfrom
zhuzhi-09:fix/26-official-launcher-folder

Conversation

@zhuzhi-09

@zhuzhi-09 zhuzhi-09 commented Nov 15, 2026 •

Copy link
Copy Markdown

变更说明 / Summary

原实现在所有平台都使用 ApplicationData/.minecraft 作为官方启动器文件夹。该路径在 macOS 与 Linux 上都不是官方启动器的实际位置,导致这两个平台无法识别官方启动器文件夹。

新增 LauncherPaths.OfficialMinecraftDirectory,按平台返回:

  • Windows:%APPDATA%\.minecraft(与原行为一致)
  • macOS:~/Library/Application Support/minecraft
  • Linux:~/.minecraft

扫描文件夹(GameFolders)与恢复文件夹名称(PageSelectLeftViewModel)统一改用该属性,保证两处判断一致。

另外,Java 扫描(DefaultPathsScanner)、Java 下载(Minecraft/Java/Download.cs)与 natives 回退路径(Launch/Natives.cs)中也有同样写死的 ApplicationData/.minecraft。修改它们会影响 Java 的下载位置,超出本 Issue 范围,未包含在本 PR 中。

关联 Issue / Related Issue

Closes #26

验证方式 / Verification

构建

  • .NET SDK 11.0.100-rc.3.26522.148,dotnet publish PCL.Launcher/PCL.Launcher.csproj -c Debug -r osx-arm64 --no-self-contained -p:Platform=ARM64,编译通过

运行测试(macOS 27.0.1,Apple Silicon)

  • 准备:~/Library/Application Support/minecraft/versions 存在
  • 修复前:“实例选择”的文件夹列表中只有 PCL 自身的 .minecraft
  • 修复后:列表中出现“官方启动器文件夹 /Users/<user>/Library/Application Support/minecraft/”
  • 截图见下方
i26_before i26_after

未覆盖

  • Windows:代码路径与原实现完全一致,未额外测试
  • Linux:未测试

AI 使用情况 / Generative Artificial Intelligence Usage

  • 使用情况 / Usage:实质性使用 / Substantial
  • 使用工具及模型 / Tools and models:Claude Code(Claude Opus 5.5)
  • 使用目的 / Purpose:定位代码、编写修复、编译测试、撰写提交信息与 PR 描述
  • 涉及范围 / Scope:LauncherPaths.cs、GameFolders.cs、PageSelectLeftViewModel.cs
  • 人工审查与验证 / Human review and verification:本人在 Mac 上操作验证修复前后的表现

提交前检查 / Checklist

  • 我已阅读并遵守 技术规范 和 生成式人工智能使用方针。/ I have read and followed the Technical Guidelines and the Generative Artificial Intelligence Usage Policy.
  • 我能解释本次修改的全部内容,包括关键逻辑、异常处理和已知限制。/ I can explain all changes, including key logic, error handling, and known limitations.
  • 我确认未伪造日志、测试结果、基准数据或其他证据。/ I confirm that no logs, test results, benchmarks, or other evidence have been fabricated.
  • 本次提交不包含与修改无关的文件变更,也未提交临时文件或构建产物。/ The PR contains no unrelated changes, temporary files, or build artifacts.
  • 所有提交均已签名,且提交信息符合提交信息规范。/ All commits are signed and follow the commit message convention.
  • 我确认 PR 描述由本人撰写,未直接提交未经核实的 AI 生成内容。/ I confirm that I wrote this PR description myself and have not submitted unverified AI-generated content.

原实现在所有平台都使用 ApplicationData/.minecraft,在 macOS 与 Linux 上
都不是官方启动器的实际位置,导致无法识别官方启动器文件夹。

新增 LauncherPaths.OfficialMinecraftDirectory,按平台返回:
- Windows:%APPDATA%\.minecraft(与原行为一致)
- macOS:~/Library/Application Support/minecraft
- Linux:~/.minecraft

扫描文件夹(GameFolders)与恢复文件夹名称(PageSelectLeftViewModel)
统一改用该属性,保证两处判断一致。

Closes PCL-Community#26
@LuLu-ling
LuLu-ling merged commit c2f020b into PCL-Community:dev Nov 15, 2026
6 checks passed
@zhuzhi-09
zhuzhi-09 deleted the fix/26-official-launcher-folder branch November 15, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C#]: “官方启动器文件夹”在非 Windows 平台上路径不正确

2 participants