correct FILE_WRITE to be opened at the end of file for lfs
This commit is contained in:
1 parent
6755a25d02
commit
7a23c671fd
3 files changed
+5
-4
No files matched your search
@@ -35,7 +35,6 @@
|
||||
|
||||
#define FILE_READ 0
|
||||
#define FILE_WRITE 1
|
||||
#define FILE_APPEND 2
|
||||
|
||||
#define FILE_NAME_MAX 255
|
||||
|
||||
|
||||
@@ -216,8 +216,7 @@ BluefuritLib::File LittleFS::_open_file (char const *filepath, uint8_t mode)
|
||||
BluefuritLib::File file(*this);
|
||||
|
||||
int flags = (mode == FILE_READ) ? LFS_O_RDONLY :
|
||||
(mode == FILE_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) :
|
||||
(mode == FILE_APPEND) ? (LFS_O_RDWR | LFS_O_CREAT | LFS_O_APPEND) : 0;
|
||||
(mode == FILE_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) : 0;
|
||||
|
||||
if ( flags )
|
||||
{
|
||||
@@ -231,6 +230,9 @@ BluefuritLib::File LittleFS::_open_file (char const *filepath, uint8_t mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
// move to end of file
|
||||
if ( mode == FILE_WRITE ) lfs_file_seek(&_lfs, fhdl, 0, LFS_SEEK_END);
|
||||
|
||||
file._hdl = fhdl;
|
||||
file._is_dir = false;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class LittleFS: public BluefuritLib::FileSystemClass
|
||||
virtual uint32_t _f_position (void* fhdl);
|
||||
virtual uint32_t _f_size (void* fhdl);
|
||||
|
||||
virtual File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual BluefuritLib::File _f_openNextFile (void* fhdl, char const* cwd, uint8_t mode);
|
||||
virtual void _f_rewindDirectory (void* fhdl);
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user