Fix handling of symbolic links in cd and ls commands

This commit is contained in:
EnderIce2 2024-04-01 03:29:34 +03:00
parent e327ca783b
commit 5b7d0106a5
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,9 @@ void cmd_cd(const char *args)
return;
}
if (thisNode->Type == NodeType::SYMLINK)
thisNode = fs->GetNodeFromPath(thisNode->Symlink);
if (thisNode->Type != NodeType::DIRECTORY)
{
printf("cd: %s: Not a directory\n", args);

View File

@ -89,6 +89,9 @@ void cmd_ls(const char *args)
return;
}
if (thisNode->Type == NodeType::SYMLINK)
thisNode = fs->GetNodeFromPath(thisNode->Symlink);
if (thisNode->Type != NodeType::DIRECTORY)
{
printf("%s%s\n", ColorNodeType(thisNode), thisNode->Name);