mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Исправляем ошибку в алгоритме чтения директории. openNextFile() возвращает файл.
This commit is contained in:
@@ -184,21 +184,22 @@ void FSEditor::getDirList(const String &path, String &output) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void FSEditor::getDirList(const String &path, String &output) {
|
void FSEditor::getDirList(const String &path, String &output) {
|
||||||
auto dir = _fs.open(path, FILE_READ);
|
File dir = _fs.open(path.c_str(), FILE_READ);
|
||||||
dir.rewindDirectory();
|
dir.rewindDirectory();
|
||||||
while (dir.openNextFile()) {
|
File file;
|
||||||
String fname = dir.name();
|
while (file = dir.openNextFile()) {
|
||||||
if (!path.endsWith("/") && !fname.startsWith("/")) {
|
String fname = file.name();
|
||||||
fname = "/" + fname;
|
//if (!path.endsWith("/") && !fname.startsWith("/")) {
|
||||||
}
|
// fname = "/" + fname;
|
||||||
fname = path + fname;
|
//}
|
||||||
if (isExcluded(_fs, fname.c_str())) {
|
//fname = path + fname;
|
||||||
continue;
|
//if (isExcluded(_fs, fname.c_str())) {
|
||||||
}
|
// continue;
|
||||||
if (dir.isDirectory()) {
|
//}
|
||||||
getDirList(fname, output);
|
//if (dir.isDirectory()) {
|
||||||
continue;
|
// getDirList(fname, output);
|
||||||
}
|
// continue;
|
||||||
|
//}
|
||||||
if (output != "[") output += ',';
|
if (output != "[") output += ',';
|
||||||
char buf[128];
|
char buf[128];
|
||||||
sprintf(buf, "{\"type\":\"file\",\"name\":\"%s\",\"size\":%d}", fname.c_str(), dir.size());
|
sprintf(buf, "{\"type\":\"file\",\"name\":\"%s\",\"size\":%d}", fname.c_str(), dir.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user