refactor: 替换 + 为 Path.Combine#2818
Open
LuLu-ling wants to merge 2 commits into
Open
Conversation
审阅者指南在整个启动器中重构路径处理逻辑,用 文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's GuideRefactors path handling across the launcher to replace manual string concatenation with Path.Combine and related helpers, improving cross-platform correctness and readability, and removes a redundant using plus a few minor cleanups. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我在这里给出了一些整体性的反馈:
- 有很多类似
Path.Combine(... ) + @"\"的写法;由于Path.Combine本身就会处理路径分隔符,建议在返回目录路径时不要再手动追加"\",这样可以减少冗余,并让代码在不同平台上更加健壮。 - 在好几处你传入的路径片段本身就包含路径分隔符(例如
Path.Combine(ModBase.ExePath, @"PCL\Pictures\"));更安全、更清晰的做法是只传入干净的片段名称(例如"PCL", "Pictures"),这样所有分隔符都可以交由Path.Combine` 统一处理。
给 AI 代理的提示
Please address the comments from this code review:
## Overall Comments
- There are many patterns like `Path.Combine(... ) + @"\"`; since `Path.Combine` already handles separators, consider returning directory paths without manually appending `"\"` to reduce redundancy and make the code more robust across platforms.
- In several places you pass segments that already include path separators (e.g. `Path.Combine(ModBase.ExePath, @"PCL\Pictures\")`); it would be safer and clearer to pass only clean segment names (e.g. `"PCL"`, "Pictures") so `Path.Combine` can handle all separators consistently.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- There are many patterns like
Path.Combine(... ) + @"\"; sincePath.Combinealready handles separators, consider returning directory paths without manually appending"\"to reduce redundancy and make the code more robust across platforms. - In several places you pass segments that already include path separators (e.g.
Path.Combine(ModBase.ExePath, @"PCL\Pictures\")); it would be safer and clearer to pass only clean segment names (e.g."PCL", "Pictures") soPath.Combinecan handle all separators consistently.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There are many patterns like `Path.Combine(... ) + @"\"`; since `Path.Combine` already handles separators, consider returning directory paths without manually appending `"\"` to reduce redundancy and make the code more robust across platforms.
- In several places you pass segments that already include path separators (e.g. `Path.Combine(ModBase.ExePath, @"PCL\Pictures\")`); it would be safer and clearer to pass only clean segment names (e.g. `"PCL"`, "Pictures") so `Path.Combine` can handle all separators consistently.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Chiloven945
previously approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
在 Minecraft 的下载、实例、整合包、崩溃处理和启动等模块中重构文件系统路径处理,将手动字符串拼接统一改为使用
Path.Combine和相关辅助方法。增强点:
Path.Combine和相关工具来构建文件和目录路径。using和字面量。Original summary in English
Summary by Sourcery
Refactor filesystem path handling across Minecraft download, instance, modpack, crash, and launch modules to use Path.Combine and related helpers instead of manual string concatenation.
Enhancements: