mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
进入系统改为自动进入用户文件夹
This commit is contained in:
@@ -14,6 +14,18 @@ namespace CMLeonOS
|
|||||||
currentDirectory = @"0:\";
|
currentDirectory = @"0:\";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileSystem(string initialPath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(initialPath))
|
||||||
|
{
|
||||||
|
currentDirectory = @"0:\";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentDirectory = initialPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string CurrentDirectory
|
public string CurrentDirectory
|
||||||
{
|
{
|
||||||
get { return currentDirectory; }
|
get { return currentDirectory; }
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ namespace CMLeonOS
|
|||||||
public bool fixmode = Kernel.FixMode;
|
public bool fixmode = Kernel.FixMode;
|
||||||
private User currentLoggedInUser;
|
private User currentLoggedInUser;
|
||||||
|
|
||||||
|
public User CurrentLoggedInUser
|
||||||
|
{
|
||||||
|
get { return currentLoggedInUser; }
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowError(string error)
|
public void ShowError(string error)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
|||||||
@@ -54,11 +54,32 @@ namespace CMLeonOS
|
|||||||
public Shell(UserSystem userSystem)
|
public Shell(UserSystem userSystem)
|
||||||
{
|
{
|
||||||
this.userSystem = userSystem;
|
this.userSystem = userSystem;
|
||||||
fileSystem = new FileSystem();
|
|
||||||
fixMode = Kernel.FixMode;
|
fixMode = Kernel.FixMode;
|
||||||
envManager = EnvironmentVariableManager.Instance;
|
envManager = EnvironmentVariableManager.Instance;
|
||||||
|
|
||||||
Commands.AliasCommand.LoadAliases();
|
Commands.AliasCommand.LoadAliases();
|
||||||
|
|
||||||
|
User currentUser = userSystem.CurrentLoggedInUser;
|
||||||
|
if (currentUser != null && !string.IsNullOrWhiteSpace(currentUser.Username))
|
||||||
|
{
|
||||||
|
string userHomePath = $@"0:\user\{currentUser.Username}";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(userHomePath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(userHomePath);
|
||||||
|
}
|
||||||
|
fileSystem = new FileSystem(userHomePath);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
fileSystem = new FileSystem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileSystem = new FileSystem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
|
|||||||
Reference in New Issue
Block a user