mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 19:02:35 +02:00
Better error messages for config file opening
This commit is contained in:
@@ -480,12 +480,16 @@ size_t MachineConfig::readFile(const char* filename, char*& buffer) {
|
|||||||
if ((path.length() > 0) && (path[0] != '/')) {
|
if ((path.length() > 0) && (path[0] != '/')) {
|
||||||
path = "/" + path;
|
path = "/" + path;
|
||||||
}
|
}
|
||||||
File file = SPIFFS.open(path, FILE_READ);
|
if (!SPIFFS.exists(path)) {
|
||||||
if (!file) {
|
log_info("Missing config file " << path);
|
||||||
log_info("Cannot open the config file " << path);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
File file = SPIFFS.open(path, FILE_READ);
|
||||||
auto filesize = file.size();
|
auto filesize = file.size();
|
||||||
|
if (filesize == 0) {
|
||||||
|
log_info("config file " << path << " is empty");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// log_debug("Configuration file has " << int(filesize) << " bytes");
|
// log_debug("Configuration file has " << int(filesize) << " bytes");
|
||||||
buffer = new char[filesize + 1];
|
buffer = new char[filesize + 1];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user