mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-01-30 22:32:51 +03:00
Update sdcard_check.cpp
fix .gz in SDCardCheckFolderFilePresence()
This commit is contained in:
@@ -69,7 +69,6 @@ int SDCardCheckRW(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SDCardCheckFolderFilePresence()
|
bool SDCardCheckFolderFilePresence()
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
@@ -125,25 +124,25 @@ bool SDCardCheckFolderFilePresence()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if file exists: index.html */
|
/* check if file exists: index.html */
|
||||||
if (stat("/sdcard/html/index.html", &sb) != 0) {
|
if ((stat("/sdcard/html/index.html", &sb) != 0) && (stat("/sdcard/html/index.html.gz", &sb) != 0)) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/index.html not found");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/index.html not found");
|
||||||
bRetval = false;
|
bRetval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if file exists: ota.html */
|
/* check if file exists: ota.html */
|
||||||
if (stat("/sdcard/html/ota_page.html", &sb) != 0) {
|
if ((stat("/sdcard/html/ota_page.html", &sb) != 0) && (stat("/sdcard/html/ota_page.html.gz", &sb) != 0)) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/ota.html not found");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/ota.html not found");
|
||||||
bRetval = false;
|
bRetval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if file exists: log.html */
|
/* check if file exists: log.html */
|
||||||
if (stat("/sdcard/html/log.html", &sb) != 0) {
|
if ((stat("/sdcard/html/log.html", &sb) != 0) && (stat("/sdcard/html/log.html.gz", &sb) != 0)) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/log.html not found");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/log.html not found");
|
||||||
bRetval = false;
|
bRetval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if file exists: common.js */
|
/* check if file exists: common.js */
|
||||||
if (stat("/sdcard/html/common.js", &sb) != 0) {
|
if ((stat("/sdcard/html/common.js", &sb) != 0) && (stat("/sdcard/html/common.js.gz", &sb) != 0)) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/common.js not found");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/common.js not found");
|
||||||
bRetval = false;
|
bRetval = false;
|
||||||
}
|
}
|
||||||
@@ -154,8 +153,9 @@ bool SDCardCheckFolderFilePresence()
|
|||||||
bRetval = false;
|
bRetval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bRetval)
|
if (bRetval) {
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check successful");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check successful");
|
||||||
|
}
|
||||||
|
|
||||||
return bRetval;
|
return bRetval;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user