fix: ToShortPath 错误地展开了相对路径
This commit is contained in:
1 parent
f57f496d25
commit
f2d4070b6a
3 files changed
+8
-7
No files matched your search
@@ -16,6 +16,7 @@ public static class HashUtils {
|
||||
HashMethod.Sha512 => SHA512.Create(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(method))
|
||||
};
|
||||
Logger.Trace($"计算文件 {method}:{filePath}");
|
||||
return BitConverter.ToString(hashImpl.ComputeHash(file)).Replace("-", "").ToLower();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ public static class PathUtils {
|
||||
|
||||
/// <summary>
|
||||
/// 若路径较长,则尽量将其转换为短路径。
|
||||
/// <para/>结果的开头不含 <c>\\?\</c>、结尾不含分隔符。
|
||||
/// <para/>结果的开头不含 <c>\\?\</c>,结尾不含分隔符。
|
||||
/// </summary>
|
||||
public static string ToShortPath(string fullName, bool keepFileName = false) {
|
||||
if (string.IsNullOrEmpty(fullName)) return fullName;
|
||||
fullName = PathUtils.ForCompare(fullName);
|
||||
if (!fullName.Contains(":")) return fullName;
|
||||
fullName = PathUtils.ForCompare(fullName);
|
||||
if (fullName.Length <= 200) return fullName;
|
||||
// 保留文件名
|
||||
string pathToKeep = "";
|
||||
|
||||
Reference in new issue
Block a user