MCPcopy Create free account
hub / github.com/andysworkshop/stm32plus / deleteFile

Method deleteFile

lib/src/filesystem/fat/FatFileSystem.cpp:478–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

uploadMethod · 0.80
removeFileMethod · 0.80
saveCalibrationMethod · 0.80

Calls 3

getNumTokensMethod · 0.80
isFileMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected