| 315 | } |
| 316 | |
| 317 | char* BaseName(const char* path){ |
| 318 | char* pathCopy = (char*)kmalloc(strlen(path) + 1); |
| 319 | strcpy(pathCopy, path); |
| 320 | |
| 321 | if(pathCopy[strlen(pathCopy) - 1] == '/'){ // Remove trailing slash |
| 322 | pathCopy[strlen(pathCopy) - 1] = 0; |
| 323 | } |
| 324 | |
| 325 | char* basename = nullptr; |
| 326 | char* temp; |
| 327 | if((temp = strrchr(pathCopy, '/'))){ |
| 328 | basename = (char*)kmalloc(strlen(temp) + 1); |
| 329 | strcpy(basename, temp); |
| 330 | |
| 331 | kfree(pathCopy); |
| 332 | } else { |
| 333 | basename = pathCopy; |
| 334 | } |
| 335 | |
| 336 | return basename; |
| 337 | } |
| 338 | |
| 339 | int Root::ReadDir(DirectoryEntry* dirent, uint32_t index){ |
| 340 | if (index < fs::volumes->get_length()){ |
no test coverage detected