mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-29 20:49:50 +00:00
Remove file first
This commit is contained in:
parent
590b8e7018
commit
bdc9c7ffd5
@ -3,14 +3,13 @@
|
||||
#ifdef FSCom
|
||||
|
||||
// Only way to work on both esp32 and nrf52
|
||||
static File openFile(const char *filename, bool fullAtomic, bool removeFirst)
|
||||
static File openFile(const char *filename, bool fullAtomic)
|
||||
{
|
||||
concurrency::LockGuard g(spiLock);
|
||||
LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic);
|
||||
#ifdef ARCH_NRF52
|
||||
lfs_assert_failed = false;
|
||||
if (removeFirst)
|
||||
FSCom.remove(filename);
|
||||
FSCom.remove(filename);
|
||||
return FSCom.open(filename, FILE_O_WRITE);
|
||||
#endif
|
||||
if (!fullAtomic)
|
||||
@ -24,7 +23,7 @@ static File openFile(const char *filename, bool fullAtomic, bool removeFirst)
|
||||
}
|
||||
|
||||
SafeFile::SafeFile(const char *_filename, bool fullAtomic, bool removeFirst)
|
||||
: filename(_filename), f(openFile(_filename, fullAtomic, removeFirst)), fullAtomic(fullAtomic)
|
||||
: filename(_filename), f(openFile(_filename, fullAtomic)), fullAtomic(fullAtomic)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
class SafeFile : public Print
|
||||
{
|
||||
public:
|
||||
explicit SafeFile(char const *filepath, bool fullAtomic = false, bool removeFirst = false);
|
||||
explicit SafeFile(char const *filepath, bool fullAtomic = false);
|
||||
|
||||
virtual size_t write(uint8_t);
|
||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||
|
Loading…
Reference in New Issue
Block a user