MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / chdir

Method chdir

source/kernel/kprocess.cpp:984–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984U32 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
1001U32 KProcess::unlinkFile(BString path) {
1002 std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(this->currentDirectory, path, false);

Callers 1

syscall_chdirFunction · 0.80

Calls 5

isDirectoryMethod · 0.80
startsWithMethod · 0.80
endsWithMethod · 0.80
substrMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected