mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 07:29:14 -08:00
Add remove SD files for Mini
This commit is contained in:
@@ -79,6 +79,10 @@ bool SDInterface::initSD() {
|
||||
SD.mkdir("/SCRIPTS");
|
||||
Serial.println("/SCRIPTS created");
|
||||
}
|
||||
|
||||
this->sd_files = new LinkedList<String>();
|
||||
|
||||
this->sd_files->add("Back");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -98,6 +102,13 @@ File SDInterface::getFile(String path) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SDInterface::removeFile(String file_path) {
|
||||
if (SD.remove(file_path))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDInterface::listDirToLinkedList(LinkedList<String>* file_names, String str_dir, String ext) {
|
||||
if (this->supported) {
|
||||
File dir = SD.open(str_dir);
|
||||
@@ -108,12 +119,18 @@ void SDInterface::listDirToLinkedList(LinkedList<String>* file_names, String str
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (entry.isDirectory())
|
||||
continue;
|
||||
|
||||
String file_name = entry.name();
|
||||
if (ext != "") {
|
||||
String file_name = entry.name();
|
||||
if (file_name.endsWith(ext)) {
|
||||
file_names->add(file_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
file_names->add(file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user