*
This commit is contained in:
1 parent
888415867a
commit
3fe3412410
2 files changed
+2
-1
No files matched your search
@@ -32,6 +32,7 @@ public static class DirectoryUtils {
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回指定路径下的所有文件夹。
|
/// 返回指定路径下的所有文件夹。
|
||||||
|
/// 路径不以分隔符结尾。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IEnumerable<string> EnumerateDirectories(string path, string searchPattern = "*", bool topDirectoryOnly = false) {
|
public static IEnumerable<string> EnumerateDirectories(string path, string searchPattern = "*", bool topDirectoryOnly = false) {
|
||||||
if (!Exists(path)) return [];
|
if (!Exists(path)) return [];
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public static class PathUtils {
|
|||||||
/// 若路径较长,则尽量将其转换为短路径。
|
/// 若路径较长,则尽量将其转换为短路径。
|
||||||
/// 若输入的是文件夹路径,不保证其结尾是否有文件夹分隔符。
|
/// 若输入的是文件夹路径,不保证其结尾是否有文件夹分隔符。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string Shorten(string fullName, bool keepFileName = false) {
|
public static string ToShortPath(string fullName, bool keepFileName = false) {
|
||||||
if (string.IsNullOrEmpty(fullName) || fullName.Length <= 200) return fullName;
|
if (string.IsNullOrEmpty(fullName) || fullName.Length <= 200) return fullName;
|
||||||
fullName = fullName.Replace('/', '\\');
|
fullName = fullName.Replace('/', '\\');
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user