From 05d8a6436206b60d9fe51444e14122f1a48bb454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=85=BE=E7=8C=AB=E8=B7=83?= <1043137532@qq.com> Date: Mon, 4 May 2026 06:31:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ToLongPath=20=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shared/Utils/PathUtils.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Shared/Utils/PathUtils.cs b/Shared/Utils/PathUtils.cs index 0fb8a5c..88a7ac1 100644 --- a/Shared/Utils/PathUtils.cs +++ b/Shared/Utils/PathUtils.cs @@ -59,13 +59,14 @@ public static class PathUtils { private static extern int GetShortPathNameW(string lpszLongPath, [Out] char[] buffer, int cchBuffer); /// - /// 将路径转换为以 \\?\ 开头的长路径格式。 - /// 这也会去除路径末尾的文件夹分隔符。 + /// 将路径转换为以 \\?\ 开头的标准长路径格式。 + /// 这会去除路径末尾的分隔符,且将 / 替换为 \。 /// public static string ToLongPath(string path) { if (string.IsNullOrWhiteSpace(path)) return path; if (path.StartsWithF(@"\\")) return path; // 已有长路径前缀 - return $@"\\?\{WithoutSeparator(path)}"; // API 要求不包含分隔符 + path = WithoutSeparator(path).Replace('/', '\\'); // API 要求这个格式…… + return $@"\\?\{path}"; } #endregion