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

Method findDirectory

src/core/FatSystem.cpp:755–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755bool FatSystem::findDirectory(FatPath &path, FatEntry &outputEntry)
756{
757 int cluster;
758 vector<string> parts = path.getParts();
759 cluster = rootDirectory;
760 outputEntry.cluster = cluster;
761
762 for (int i=0; i<parts.size(); i++) {
763 if (parts[i] != "") {
764 parts[i] = strtolower(parts[i]);
765 vector<FatEntry> entries = getEntries(cluster);
766 vector<FatEntry>::iterator it;
767 bool found = false;
768
769 for (it=entries.begin(); it!=entries.end(); it++) {
770 FatEntry &entry = *it;
771 string name = entry.getFilename();
772 if (entry.isDirectory() && strtolower(name) == parts[i]) {
773 outputEntry = entry;
774 cluster = entry.cluster;
775 found = true;
776 }
777 }
778
779 if (!found) {
780 cerr << "Error: directory " << path.getPath() << " not found" << endl;
781 return false;
782 }
783 }
784 }
785
786 return true;
787}
788
789bool FatSystem::findFile(FatPath &path, FatEntry &outputEntry)
790{

Callers

nothing calls this directly

Calls 5

strtolowerFunction · 0.85
getPartsMethod · 0.80
isDirectoryMethod · 0.80
getPathMethod · 0.80
getFilenameMethod · 0.45

Tested by

no test coverage detected