Update xdrv_98_filesystem.ino

This commit is contained in:
gemu2015 2021-01-01 08:41:36 +01:00
parent 55d0f99910
commit 03a9d5b71f
1 changed files with 18 additions and 19 deletions

View File

@ -373,28 +373,28 @@ void UFS_ListDir(char *path, uint8_t depth) {
if (!*(pp + 1)) pp++; if (!*(pp + 1)) pp++;
char *cp = name; char *cp = name;
// osx formatted disks contain a lot of stuff we dont want // osx formatted disks contain a lot of stuff we dont want
if (ufs_reject((char*)ep)) goto fclose; if (!ufs_reject((char*)ep)) {
for (uint8_t cnt = 0; cnt<depth; cnt++) { for (uint8_t cnt = 0; cnt<depth; cnt++) {
*cp++ = '-'; *cp++ = '-';
}
sprintf(cp, format, ep);
if (entry.isDirectory()) {
snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp,ep);
WSContentSend_P(UFS_FORM_SDC_DIRd, npath,ep,name);
uint8_t plen = strlen(path);
if (plen>1) {
strcat(path, "/");
} }
strcat(path, ep);
UFS_ListDir(path, depth + 4); sprintf(cp, format, ep);
path[plen] = 0; if (entry.isDirectory()) {
} else { snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp,ep);
WSContentSend_P(UFS_FORM_SDC_DIRd, npath,ep,name);
uint8_t plen = strlen(path);
if (plen>1) {
strcat(path, "/");
}
strcat(path, ep);
UFS_ListDir(path, depth + 4);
path[plen] = 0;
} else {
snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp,ep); snprintf_P(npath, sizeof(npath), UFS_FORM_SDC_HREF, WiFi.localIP().toString().c_str(), pp,ep);
WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr, entry.size()); WSContentSend_P(UFS_FORM_SDC_DIRb, npath, ep, name, tstr, entry.size());
}
} }
fclose:
entry.close(); entry.close();
} }
dir.close(); dir.close();
@ -405,8 +405,6 @@ uint8_t UFS_DownloadFile(char *file) {
File download_file; File download_file;
WiFiClient download_Client; WiFiClient download_Client;
//AddLog_P(LOG_LEVEL_INFO, PSTR("file not found %s"),file);
if (!ufsp->exists(file)) { if (!ufsp->exists(file)) {
AddLog_P(LOG_LEVEL_INFO, PSTR("file not found")); AddLog_P(LOG_LEVEL_INFO, PSTR("file not found"));
return 0; return 0;
@ -457,6 +455,7 @@ uint8_t UFS_DownloadFile(char *file) {
// loop(); // loop();
//} //}
} }
delay(0);
} }
download_file.close(); download_file.close();
download_Client.stop(); download_Client.stop();