修复File中合成路径的错误

This commit is contained in:
2025-11-25 17:03:13 +08:00
parent fced17765c
commit 0b563f393b

View File

@@ -460,7 +460,7 @@ namespace Convention
#region Operator
public static ToolFile operator |(ToolFile left, string rightPath)
public static ToolFile operator |(ToolFile left, [Opt] string rightPath)
{
if (rightPath == null)
{
@@ -472,12 +472,7 @@ namespace Convention
return new ToolFile(second);
else if (first == "../")
return new ToolFile($"{new ToolFile(left.GetAbsPath()).GetParentDir()}/{second}");
return new ToolFile($"{first}/{second}");
}
public static ToolFile operator |(ToolFile left, ToolFile rightPath)
{
string lp = left.GetFullPath();
return new ToolFile(Path.Combine(lp, rightPath));
return new ToolFile($"{first}{(first.EndsWith('/') ? "" : "/")}{second}");
}
public override bool Equals(object obj)