| 982 | } |
| 983 | |
| 984 | U32 KProcess::chdir(BString path) { |
| 985 | std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(this->currentDirectory, path, true); |
| 986 | if (!node) |
| 987 | return -K_ENOENT; |
| 988 | if (!node->isDirectory()) |
| 989 | return -K_ENOTDIR; |
| 990 | if (path.startsWith('/')) { |
| 991 | this->currentDirectory = path; |
| 992 | } else { |
| 993 | this->currentDirectory = this->currentDirectory+"/"+path; |
| 994 | } |
| 995 | if (this->currentDirectory.endsWith('/')) { |
| 996 | this->currentDirectory = this->currentDirectory.substr(0, this->currentDirectory.length()-1); |
| 997 | } |
| 998 | return 0; |
| 999 | } |
| 1000 | |
| 1001 | U32 KProcess::unlinkFile(BString path) { |
| 1002 | std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(this->currentDirectory, path, false); |
no test coverage detected