Skip to content

Commit 20f878e

Browse files
committed
fix: normalize native Windows paths in CI fixtures
1 parent 5bbefa0 commit 20f878e

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎README.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
[![C++23](https://img.shields.io/badge/C%2B%2B-23-blue.svg)](https://en.cppreference.com/w/cpp/23)
99
[![Module](https://img.shields.io/badge/module-ok-green.svg)](https://en.cppreference.com/w/cpp/language/modules)
1010
[![License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](LICENSE)
11+
[![ci](https://github.com/mcpp-community/mcpp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci.yml)
1112

1213
| [文档](docs/zh/) · [快速开始](docs/zh/01-getting-started.md) · [mcpp.toml 指南](docs/zh/04-mcpp-toml.md) · [示例项目](docs/zh/03-examples.md) · [工具链管理](docs/zh/20-toolchains.md) |
1314
|:---:|
1415
| [包索引 mcpp-index](https://mcpplibs.github.io/mcpp-index/) · [模块化库 mcpplibs](https://github.com/mcpplibs) · [社区论坛](https://forum.d2learn.org/category/20) · [Issues](https://github.com/mcpp-community/mcpp/issues) · [Releases](https://github.com/mcpp-community/mcpp/releases) |
15-
| [![ci](https://github.com/mcpp-community/mcpp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mcpp-community/mcpp/actions/workflows/ci.yml) |
1616
| 支持的插件 · [mcpp-language-server(mcppls)](https://github.com/Sunrisepeak/mcpp-language-server) —— C++20/23 模块语言服务器,面向 VS Code、Zed、CLion、Neovim、AI Agent(MCP)与 CI |
1717

1818
<p align="center">

‎tests/e2e/00_fixture_path_hygiene.sh‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@
2525
set -euo pipefail
2626

2727
HERE="$(cd "$(dirname "$0")" && pwd)"
28+
source "$HERE/_host_path.sh"
29+
30+
# CI passes MCPP_HOME in native Windows spelling, not just Git Bash spelling.
31+
# Both must produce paths safe to interpolate into TOML basic strings.
32+
case "$(uname -s)" in
33+
MINGW* | MSYS* | CYGWIN*)
34+
[[ "$(host_path 'C:\Users\runner admin\.mcpp/registry')" == 'C:/Users/runner admin/.mcpp/registry' ]] || {
35+
echo "FAIL: host_path did not normalize a native Windows absolute path"
36+
exit 1
37+
}
38+
[[ "$(host_path 'C:/Users/runner admin/.mcpp/registry')" == 'C:/Users/runner admin/.mcpp/registry' ]] || exit 1
39+
;;
40+
esac
41+
[[ "$(host_path '../relative directory')" == '../relative directory' ]] || exit 1
2842

2943
# A TOML `path` key: either at the start of a line, or inside an inline table
3044
# (`{ path = "..." }`). Anchoring this way is what keeps shell assignments such

‎tests/e2e/_host_path.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ host_path() {
3636
# agree and Windows accepts `/` as a separator. Passing one to `cygpath -m`
3737
# would silently ANCHOR it at the current directory — which is not where the
3838
# manifest being written lives — so relative input is returned untouched.
39+
# MCPP_HOME can arrive from CI as C:\Users\...; it is absolute too.
3940
case "$1" in
40-
/*) ;;
41+
/* | [A-Za-z]:[\\/]*) ;;
4142
*) printf '%s' "$1"; return 0 ;;
4243
esac
4344
case "$(uname -s)" in

0 commit comments

Comments
 (0)