Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/mesh/shim/repeater/InternalFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ class Adafruit_LittleFS {
// this fails, and it fails silently as a null file.
auto slash = p.find_last_of('/');
if (slash != std::string::npos) ensureDir(p.substr(0, slash));
FILE* f = fopen(p.c_str(), mode);
// FILE_O_WRITE as LittleFS opens it on nRF52: not truncated, at the end.
FILE* f;
if (strcmp(mode, FILE_O_WRITE) == 0) {
f = fopen(p.c_str(), "r+b");
if (!f) f = fopen(p.c_str(), "w+b");
if (f) fseek(f, 0, SEEK_END);
} else {
f = fopen(p.c_str(), mode);
}
return File(f, p);
}

Expand Down