mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 02:42:36 +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] != '/')) {
|
||||
path = "/" + path;
|
||||
}
|
||||
File file = SPIFFS.open(path, FILE_READ);
|
||||
if (!file) {
|
||||
log_info("Cannot open the config file " << path);
|
||||
if (!SPIFFS.exists(path)) {
|
||||
log_info("Missing config file " << path);
|
||||
return 0;
|
||||
}
|
||||
File file = SPIFFS.open(path, FILE_READ);
|
||||
auto filesize = file.size();
|
||||
if (filesize == 0) {
|
||||
log_info("config file " << path << " is empty");
|
||||
return 0;
|
||||
}
|
||||
// log_debug("Configuration file has " << int(filesize) << " bytes");
|
||||
buffer = new char[filesize + 1];
|
||||
|
||||
|
Reference in New Issue
Block a user