mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
盘符操控
This commit is contained in:
@@ -1 +1 @@
|
|||||||
2026-02-25 15:29:49
|
2026-02-25 16:45:43
|
||||||
@@ -1 +1 @@
|
|||||||
9b783e0
|
87d30be
|
||||||
@@ -71,8 +71,8 @@ namespace CMLeonOS
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
Console.WriteLine("Kernel load done!");
|
// Console.WriteLine("Kernel load done!");
|
||||||
Console.WriteLine(@"----------------------------------------------------------");
|
// Console.WriteLine(@"----------------------------------------------------------");
|
||||||
Console.WriteLine(@" ____ __ __ _ ___ ____ ");
|
Console.WriteLine(@" ____ __ __ _ ___ ____ ");
|
||||||
Console.WriteLine(@" / ___| \/ | | ___ ___ _ __ / _ \/ ___| ");
|
Console.WriteLine(@" / ___| \/ | | ___ ___ _ __ / _ \/ ___| ");
|
||||||
Console.WriteLine(@" | | | |\/| | | / _ \/ _ \| '_ \| | | \___ \ ");
|
Console.WriteLine(@" | | | |\/| | | / _ \/ _ \| '_ \| | | \___ \ ");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace CMLeonOS
|
|||||||
|
|
||||||
private static bool ContainsInvalidChars(string input)
|
private static bool ContainsInvalidChars(string input)
|
||||||
{
|
{
|
||||||
char[] invalidChars = { '<', '>', ':', '"', '|', '?', '*' };
|
char[] invalidChars = { '<', '>', '"', '|', '?', '*' };
|
||||||
foreach (char c in invalidChars)
|
foreach (char c in invalidChars)
|
||||||
{
|
{
|
||||||
if (input.Contains(c.ToString()))
|
if (input.Contains(c.ToString()))
|
||||||
@@ -59,6 +59,18 @@ namespace CMLeonOS
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path == @"0:\")
|
||||||
|
{
|
||||||
|
currentDirectory = @"0:\";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path == @"1:\")
|
||||||
|
{
|
||||||
|
currentDirectory = @"1:\";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string fullPath = GetFullPath(path);
|
string fullPath = GetFullPath(path);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -414,6 +426,11 @@ namespace CMLeonOS
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path.StartsWith(@"1:\"))
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
if (path == ".")
|
if (path == ".")
|
||||||
{
|
{
|
||||||
return currentDirectory;
|
return currentDirectory;
|
||||||
@@ -421,16 +438,16 @@ namespace CMLeonOS
|
|||||||
|
|
||||||
if (path == "..")
|
if (path == "..")
|
||||||
{
|
{
|
||||||
if (currentDirectory == @"0:\")
|
if (currentDirectory == @"0:\" || currentDirectory == @"1:\")
|
||||||
{
|
{
|
||||||
return @"0:\";
|
return currentDirectory;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int lastSlash = currentDirectory.LastIndexOf('\\');
|
int lastSlash = currentDirectory.LastIndexOf('\\');
|
||||||
if (lastSlash == 2) // 0:\
|
if (lastSlash == 2) // 0:\ or 1:\
|
||||||
{
|
{
|
||||||
return @"0:\";
|
return currentDirectory.Substring(0, 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -441,7 +458,7 @@ namespace CMLeonOS
|
|||||||
|
|
||||||
if (path.StartsWith("../") || path.StartsWith("..\\"))
|
if (path.StartsWith("../") || path.StartsWith("..\\"))
|
||||||
{
|
{
|
||||||
if (currentDirectory == @"0:\")
|
if (currentDirectory == @"0:\" || currentDirectory == @"1:\")
|
||||||
{
|
{
|
||||||
Console.WriteLine("Error: Cannot go above root directory");
|
Console.WriteLine("Error: Cannot go above root directory");
|
||||||
return currentDirectory;
|
return currentDirectory;
|
||||||
@@ -472,9 +489,9 @@ namespace CMLeonOS
|
|||||||
for (int i = 0; i < level; i++)
|
for (int i = 0; i < level; i++)
|
||||||
{
|
{
|
||||||
int lastSlash = resultPath.LastIndexOf('\\');
|
int lastSlash = resultPath.LastIndexOf('\\');
|
||||||
if (lastSlash == 2) // 0:\
|
if (lastSlash == 2) // 0:\ or 1:\
|
||||||
{
|
{
|
||||||
resultPath = @"0:\";
|
resultPath = resultPath.Substring(0, 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user