diff options
| author | ruki <[email protected]> | 2018-01-28 21:01:37 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-28 21:01:37 +0800 |
| commit | c547689e9141b412ac5a45293538215a998b299d (patch) | |
| tree | f8e13aa11f45576d1f71d85de2fd1b7e88645f2a | |
| parent | 25f2dfa8baa7121817dd1d614bfd15dc2cb12f00 (diff) | |
fix os.cd to windows root path
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | core/src/tbox/src/tbox/platform/path.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 18dbff03e..b01d5cc4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * [#151](https://github.com/tboox/xmake/issues/151): Fix `os.nuldev()` for gcc on mingw * [#150](https://github.com/tboox/xmake/issues/150): Fix the command line string limitation for `ar.exe` * Fix `xmake f --cross` error +* Fix `os.cd` to the windows root path bug ## v2.1.8 @@ -446,6 +447,7 @@ * [#151](https://github.com/tboox/xmake/issues/151): 修复`os.nuldev()`在mingw上传入gcc时出现问题 * [#150](https://github.com/tboox/xmake/issues/150): 修复windows下ar.exe打包过长obj列表参数,导致失败问题 * 修复`xmake f --cross`无法配置问题 +* 修复`os.cd`到windows根路径问题 ## v2.1.8 diff --git a/core/src/tbox/src/tbox/platform/path.c b/core/src/tbox/src/tbox/platform/path.c index 3137d41cf..34c5af505 100644 --- a/core/src/tbox/src/tbox/platform/path.c +++ b/core/src/tbox/src/tbox/platform/path.c @@ -117,6 +117,13 @@ tb_size_t tb_path_translate(tb_char_t* path, tb_size_t size, tb_size_t maxn) { // get the upper drive prefix path[0] = tb_toupper(path[0]); + + // root? patch "x:" => "x:\" + if (q == path + 2 && q + 1 < path + maxn) + { + *q++ = TB_PATH_SEPARATOR; + *q = '\0'; + } } // trace |
