| 213 | } |
| 214 | |
| 215 | FsNode* ResolveParent(const char* path, const char* workingDir){ |
| 216 | char* pathCopy = (char*)kmalloc(strlen(path) + 1); |
| 217 | strcpy(pathCopy, path); |
| 218 | |
| 219 | if(pathCopy[strlen(pathCopy) - 1] == '/'){ // Remove trailing slash |
| 220 | pathCopy[strlen(pathCopy) - 1] = 0; |
| 221 | } |
| 222 | |
| 223 | char* dirPath = strrchr(pathCopy, '/'); |
| 224 | |
| 225 | FsNode* parentDirectory = nullptr; |
| 226 | |
| 227 | if(dirPath == nullptr){ |
| 228 | parentDirectory = fs::ResolvePath(workingDir); |
| 229 | } else { |
| 230 | *(dirPath - 1) = 0; // Cut off the directory name from the path copy |
| 231 | parentDirectory = fs::ResolvePath(pathCopy, workingDir); |
| 232 | } |
| 233 | |
| 234 | kfree(pathCopy); |
| 235 | return parentDirectory; |
| 236 | } |
| 237 | |
| 238 | FsNode* ResolveParent(const char* path, FsNode* workingDir){ |
| 239 | char* pathCopy = (char*)kmalloc(strlen(path) + 1); |
no test coverage detected