[2.0.0] FS::name() returns the item name as in Arduino SD (#4892)

* FS::name() returns the item name as in Arduino SD

Added method FS::path() that returns the full path

* Adjust examples
This commit is contained in:
Me No Dev
2021-04-15 17:25:01 +03:00
committed by GitHub
parent 89e7893b1a
commit f6c9faf4da
17 changed files with 63 additions and 46 deletions

View File

@ -207,7 +207,7 @@ void handleFileList() {
output += "{\"type\":\"";
output += (file.isDirectory()) ? "dir" : "file";
output += "\",\"name\":\"";
output += String(file.name()).substring(1);
output += String(file.path()).substring(1);
output += "\"}";
file = root.openNextFile();
}

View File

@ -229,7 +229,7 @@ void printDirectory() {
output += "{\"type\":\"";
output += (entry.isDirectory()) ? "dir" : "file";
output += "\",\"name\":\"";
output += entry.name();
output += entry.path();
output += "\"";
output += "}";
server.sendContent(output);