Skip to content

[GFX-724] fix(runtime): PathHelper.Combine 绝对路径段正确追加分隔符 - #15

Merged
AlianBlank merged 1 commit into
mainfrom
feature/gfx-724
Aug 29, 2026
Merged

[GFX-724] fix(runtime): PathHelper.Combine 绝对路径段正确追加分隔符#15
AlianBlank merged 1 commit into
mainfrom
feature/gfx-724

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 删除 Runtime/Helper/PathHelper.csCombine 非末段拼接的 StartsWithFast(separator) 跳过分支:以 / 开头且不以分隔符结尾的绝对路径段不再与后段粘连(/Users/blank/cache + img.png 旧产出 /Users/blank/cacheimg.png
  • / 段、尾 /、尾 \ 段行为不变(仍由 EndsWith 判定覆盖);对外 API 签名不变
  • Tests/UtilityPathTests.cs 新增 #region PathHelper.Combine 七个回归用例(对照 GameFrameX.Godot 2513f60 用例语义)

Test plan

  • 独立差分验证(dotnet 10 + 真实源码 + UnityEngine shim):修复前 7 用例 2 败(两个绝对路径用例,复现 issue 现象)→ 修复后 7/7 通过;其余 5 类输入修复前后输出逐字节一致
  • 编译烟测:完整修改版 UtilityPathTests.cs + 修复后 PathHelper + Utility.Path 门面对 Unity nunit.framework.dll 编译 0 错误
  • Unity Editor 导入包无编译报错;Test Runner 执行新增 7 用例(本环境无法启动 Editor,人工项)
  • imagecache / startup 等消费方绝对路径场景落盘位置正确(附带纠正包内 BuildProductHelper.cs:270 传 projectDir.Parent.FullName 绝对路径段的同款粘连)

Linear: GFX-724

Summary by CodeRabbit

  • Bug Fixes

    • 修复路径拼接时分隔符判断错误的问题。
    • 现在会为缺少末尾分隔符的路径段正确添加分隔符,并避免重复添加。
  • Tests

    • 新增多项路径拼接测试,覆盖相对路径、绝对路径及不同斜杠组合等场景。

删除非末段拼接时 StartsWith(分隔符) 的跳过分支:以 / 开头且不以
分隔符结尾的绝对路径段(如 /Users/xxx/cache)不再与后段粘连;纯 /
段与尾分隔符段行为不变(EndsWith 判定覆盖)。补 7 个 Combine 回归
用例(对照 GameFrameX.Godot 2513f60 用例语义)。

Linear: GFX-724
@linear-code

linear-code Bot commented Aug 29, 2026

Copy link
Copy Markdown

GFX-724

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f029070-c067-493f-92f4-58b47e66dd1a

📥 Commits

Reviewing files that changed from the base of the PR and between 2fae759 and fd57db5.

📒 Files selected for processing (2)
  • Runtime/Helper/PathHelper.cs
  • Tests/UtilityPathTests.cs
💤 Files with no reviewable changes (1)
  • Runtime/Helper/PathHelper.cs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

PathHelper.Combine 现在检查路径段末尾的分隔符,并为需要拼接的路径段追加分隔符。UtilityPathTests 新增 7 个测试,覆盖多种路径组合场景。

Changes

路径拼接行为

Layer / File(s) Summary
组合路径行为与测试
Runtime/Helper/PathHelper.cs, Tests/UtilityPathTests.cs
PathHelper.Combine 根据路径段末尾判断 /\。测试覆盖单段路径、相对路径、绝对路径、尾随分隔符及多段路径。

Estimated code review effort: 2 (简单) | ~10 分钟

Merge Risk: ⚪ Minimal · up to fd57d

This change fixes absolute-path joining so subsequent path segments are separated correctly while preserving existing trailing-separator behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确描述了主要变更:修复 PathHelper.Combine 对绝对路径段追加分隔符的问题。标题简洁、具体,并包含关联任务编号。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/gfx-724

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AlianBlank
AlianBlank merged commit e89eb8c into main Aug 29, 2026
3 checks passed
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.

1 participant