Skip to content

Commit

Permalink
Remove unused code parts, make filesystem.h implementation closer to …
Browse files Browse the repository at this point in the history
…sdcard.h
  • Loading branch information
frostmorn committed Mar 20, 2024
1 parent f1a7e0b commit 6101759
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
45 changes: 0 additions & 45 deletions sdk/lib/lilka/src/lilka/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,51 +69,6 @@ int Filesystem::listDir(String path, Entry entries[]) {
return i;
}

int Filesystem::readdir(String filenames[]) {
File _root = fs->open("/");
int count = 0;
File file = _root.openNextFile();
while (file) {
if (file.isDirectory()) {
file.close();
file = _root.openNextFile();
continue;
}
filenames[count++] = file.name();
file.close();
file = _root.openNextFile();
}
_root.close();
// Sort filenames
qsort(filenames, count, sizeof(String), [](const void* a, const void* b) -> int {
const String* ea = static_cast<const String*>(a);
const String* eb = static_cast<const String*>(b);
return ea->compareTo(*eb);
});
return count;
}

int Filesystem::readdir(String filenames[], String extension) {
File _root = fs->open("/");
int count = 0;
File file = _root.openNextFile();
while (file) {
if (file.isDirectory()) {
file.close();
file = _root.openNextFile();
continue;
}
String name = file.name();
if (name.endsWith(extension)) {
filenames[count++] = name;
}
file.close();
file = _root.openNextFile();
}
_root.close();
return count;
}

size_t Filesystem::getEntryCount(String path) {
size_t countFiles = 0;

Expand Down
2 changes: 0 additions & 2 deletions sdk/lib/lilka/src/lilka/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class Filesystem {
bool available();

int listDir(String path, Entry entries[]);
int readdir(String filenames[]);
int readdir(String filenames[], String extension);
size_t getEntryCount(String path);
String abspath(String filename);

Expand Down

0 comments on commit 6101759

Please sign in to comment.