mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
NRF52 SafeFile should not remove / rename files (#5840)
This commit is contained in:
parent
89a9e0b99d
commit
1c0f43c8e2
@ -6,6 +6,11 @@
|
|||||||
static File openFile(const char *filename, bool fullAtomic)
|
static File openFile(const char *filename, bool fullAtomic)
|
||||||
{
|
{
|
||||||
concurrency::LockGuard g(spiLock);
|
concurrency::LockGuard g(spiLock);
|
||||||
|
LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic);
|
||||||
|
#ifdef ARCH_NRF52
|
||||||
|
lfs_assert_failed = false;
|
||||||
|
return FSCom.open(filename, FILE_O_WRITE);
|
||||||
|
#endif
|
||||||
if (!fullAtomic)
|
if (!fullAtomic)
|
||||||
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
|
FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists)
|
||||||
|
|
||||||
@ -14,7 +19,6 @@ static File openFile(const char *filename, bool fullAtomic)
|
|||||||
|
|
||||||
// clear any previous LFS errors
|
// clear any previous LFS errors
|
||||||
lfs_assert_failed = false;
|
lfs_assert_failed = false;
|
||||||
|
|
||||||
return FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
|
return FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +61,10 @@ bool SafeFile::close()
|
|||||||
spiLock->lock();
|
spiLock->lock();
|
||||||
f.close();
|
f.close();
|
||||||
spiLock->unlock();
|
spiLock->unlock();
|
||||||
|
|
||||||
|
#ifdef ARCH_NRF52
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
if (!testReadback())
|
if (!testReadback())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user