Skip to content

Commit

Permalink
Use file.println() instead of write
Browse files Browse the repository at this point in the history
file.write was used for uint8_t and file.print for char*, now it's not that strict anymore but it can still create compilation issues on older versions.
  • Loading branch information
Spacehuhn committed Nov 8, 2019
1 parent cfee596 commit ee141ff
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions esp_duck/spiffs.cpp
Expand Up @@ -68,7 +68,7 @@ namespace spiffs {
size_t size(String fileName) {
fixPath(fileName);

File f { SPIFFS.open(fileName, "r") };
File f = SPIFFS.open(fileName, "r");

return f.size();
}
Expand All @@ -86,7 +86,7 @@ namespace spiffs {
void create(String fileName) {
fixPath(fileName);

File f { SPIFFS.open(fileName, "a+") };
File f = SPIFFS.open(fileName, "a+");

f.close();
}
Expand All @@ -105,11 +105,10 @@ namespace spiffs {
}

void write(String fileName, const char* str) {
File f { open(fileName) };
File f = open(fileName);

if (f) {
f.write(str);
f.write("\n");
f.println(str);
f.close();
debugln("Wrote file");
} else {
Expand All @@ -118,7 +117,7 @@ namespace spiffs {
}

void write(String fileName, const uint8_t* buf, size_t len) {
File f { open(fileName) };
File f = open(fileName);

if (f) {
f.write(buf, len);
Expand Down Expand Up @@ -210,4 +209,4 @@ namespace spiffs {
bool streaming() {
return streamFile;
}
}
}

0 comments on commit ee141ff

Please sign in to comment.