MCPcopy Create free account
hub / github.com/Gregwar/fatcat / findFile

Method findFile

src/core/FatSystem.cpp:789–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789bool FatSystem::findFile(FatPath &path, FatEntry &outputEntry)
790{
791 bool found = false;
792 string dirname = path.getDirname();
793 string basename = path.getBasename();
794 basename = strtolower(basename);
795
796 FatPath parent(dirname);
797 FatEntry parentEntry;
798 if (findDirectory(parent, parentEntry)) {
799 vector<FatEntry> entries = getEntries(parentEntry.cluster);
800 vector<FatEntry>::iterator it;
801
802 for (it=entries.begin(); it!=entries.end(); it++) {
803 FatEntry &entry = (*it);
804 if (strtolower(entry.getFilename()) == basename) {
805 outputEntry = entry;
806
807 if (entry.size == 0) {
808 found = true;
809 } else {
810 return true;
811 }
812 }
813 }
814 }
815
816 return found;
817}
818
819void FatSystem::readFile(FatPath &path, FILE *f)
820{

Callers 1

mainFunction · 0.80

Calls 4

strtolowerFunction · 0.85
getDirnameMethod · 0.80
getBasenameMethod · 0.80
getFilenameMethod · 0.45

Tested by

no test coverage detected