Open file for write should truncate file to match SD.h implementation
This commit is contained in:
@@ -208,7 +208,7 @@ bool SDCardManager::openFileForRead(const char* moduleName, const char* path, Fs
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = sd.open(path, FILE_READ);
|
file = sd.open(path, O_RDONLY);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf("[%lu] [%s] Failed to open file for reading: %s\n", millis(), moduleName, path);
|
Serial.printf("[%lu] [%s] Failed to open file for reading: %s\n", millis(), moduleName, path);
|
||||||
return false;
|
return false;
|
||||||
@@ -225,7 +225,7 @@ bool SDCardManager::openFileForRead(const char* moduleName, const String& path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SDCardManager::openFileForWrite(const char* moduleName, const char* path, FsFile& file) {
|
bool SDCardManager::openFileForWrite(const char* moduleName, const char* path, FsFile& file) {
|
||||||
file = sd.open(path, FILE_WRITE);
|
file = sd.open(path, O_RDWR | O_CREAT | O_TRUNC);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf("[%lu] [%s] Failed to open file for writing: %s\n", millis(), moduleName, path);
|
Serial.printf("[%lu] [%s] Failed to open file for writing: %s\n", millis(), moduleName, path);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user