mirror of
https://github.com/RubyMetric/chsrc
synced 2025-09-11 05:03:57 +08:00
test
This commit is contained in:
parent
5f77b80a4b
commit
0a91a9bdd5
23
lib/xy.h
23
lib/xy.h
@ -912,25 +912,18 @@ xy_normalize_path (const char *path)
|
|||||||
{
|
{
|
||||||
char *new = xy_str_strip (path); // 防止开发者多写了空白符
|
char *new = xy_str_strip (path); // 防止开发者多写了空白符
|
||||||
|
|
||||||
if (xy_on_windows)
|
if (xy_str_start_with (new, "~"))
|
||||||
{
|
|
||||||
if (xy_str_start_with (new, "~/"))
|
|
||||||
{
|
|
||||||
// 或 %USERPROFILE%
|
|
||||||
new = xy_strjoin (3, xy_os_home, "\\",
|
|
||||||
xy_str_delete_prefix (new, "~/"));
|
|
||||||
}
|
|
||||||
new = xy_str_gsub (new, "/", "\\");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xy_str_start_with (new, "~/"))
|
|
||||||
{
|
{
|
||||||
new = xy_strjoin (3, xy_os_home, "/",
|
new = xy_strjoin (3, xy_os_home, "/",
|
||||||
xy_str_delete_prefix (new, "~/"));
|
xy_str_delete_prefix (new, "~"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new = xy_str_gsub (new, "\\", "/");
|
||||||
|
new = xy_str_gsub (new, "//", "/");
|
||||||
|
|
||||||
|
if (xy_on_windows)
|
||||||
|
return xy_str_gsub (new, "/", "\\");
|
||||||
|
else
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user