This commit is contained in:
龙腾猫跃 committed 2026-05-07 11:07:19 +08:00
1 parent b26e2c77e6
commit 2d682afd2c
4 files changed
+69 -3

No files matched your search

+2 -2
View File
@@ -88,8 +88,8 @@ public static class PathUtils {
/// 去除路径末尾的文件名。
/// 若路径以分隔符结尾,则不作处理。
/// </summary>
public static string? RemoveFileName(string? path) {
if (path is null || string.IsNullOrEmpty(path)) return path;
public static string RemoveFileName(string? path) {
if (path is null || string.IsNullOrEmpty(path)) return "";
if (path.EndsWithF(Path.DirectorySeparatorChar) || path.EndsWithF(Path.AltDirectorySeparatorChar)) return path;
return Path.GetDirectoryName(path) ?? "";
}