| 476 | */ |
| 477 | |
| 478 | bool FatFileSystem::deleteFile(const char *filename) { |
| 479 | |
| 480 | FatDirectoryIterator *it; |
| 481 | bool retval; |
| 482 | |
| 483 | // tokenise the path |
| 484 | |
| 485 | TokenisedPathname tp(filename); |
| 486 | if(tp.getNumTokens() == 0) |
| 487 | return errorProvider.set(ErrorProvider::ERROR_PROVIDER_FILESYSTEM,E_INVALID_PATHNAME); |
| 488 | |
| 489 | // get the directory entry for the file |
| 490 | |
| 491 | if(!getDirectoryIteratorPointingToFile(tp,it)) |
| 492 | return false; |
| 493 | |
| 494 | // it must be a file |
| 495 | |
| 496 | DirectoryEntryWithLocation& dirent=it->getDirectoryEntryWithLocation(); |
| 497 | if(!dirent.isFile()) |
| 498 | retval=errorProvider.set(ErrorProvider::ERROR_PROVIDER_FILESYSTEM,E_NOT_A_FILE); |
| 499 | else |
| 500 | retval=fullyDelete(*it); |
| 501 | |
| 502 | delete it; |
| 503 | return retval; |
| 504 | } |
| 505 | |
| 506 | /* |
| 507 | * deallocate and delete |
no test coverage detected