From f3226eb2eab9814e8a185bca9df307e3c6b74c0d Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Fri, 13 Feb 2026 14:06:44 +0800 Subject: [PATCH] =?UTF-8?q?ls=E5=91=BD=E4=BB=A4=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildTime.txt | 2 +- GitCommit.txt | 2 +- System/FileSystem.cs | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/BuildTime.txt b/BuildTime.txt index 5f16e49..c0ca97e 100644 --- a/BuildTime.txt +++ b/BuildTime.txt @@ -1 +1 @@ -2026-02-12 23:50:58 \ No newline at end of file +2026-02-13 13:54:14 \ No newline at end of file diff --git a/GitCommit.txt b/GitCommit.txt index a4f6968..f21a18f 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -6107ecc \ No newline at end of file +82ecd84 \ No newline at end of file diff --git a/System/FileSystem.cs b/System/FileSystem.cs index 6cadc32..415dea5 100644 --- a/System/FileSystem.cs +++ b/System/FileSystem.cs @@ -114,50 +114,51 @@ namespace CMLeonOS { if (Directory.Exists(fullPath)) { - // 列出当前目录下的文件和子目录 string displayPath = path == "." ? CurrentDirectory : path; Console.WriteLine($"Contents of {displayPath}:"); - // 列出子目录 try { var dirs = Directory.GetDirectories(fullPath); foreach (var dir in dirs) { - // 使用Path.GetFileName获取目录名,避免Substring可能导致的问题 string dirName = Path.GetFileName(dir); + Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"[DIR] {dirName}"); + Console.ResetColor(); } } catch { - // 可能没有权限或其他错误 } - // 列出文件 try { var files = Directory.GetFiles(fullPath); foreach (var file in files) { - // 使用Path.GetFileName获取文件名,避免Substring可能导致的问题 string fileName = Path.GetFileName(file); + Console.ForegroundColor = ConsoleColor.White; Console.WriteLine($"[FILE] {fileName}"); + Console.ResetColor(); } } catch { - // 可能没有权限或其他错误 } } else { + Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Directory not found: {path}"); + Console.ResetColor(); } } catch (Exception ex) { + Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Error listing files: {ex.Message}"); + Console.ResetColor(); } }