@@ -22,35 +22,35 @@ littlefs_esp32_filesystem.cpp - ESP3D littlefs filesystem configuration class
22
22
#include " ../esp_filesystem.h"
23
23
#include " ../../../core/genLinkedList.h"
24
24
#include < FS.h>
25
- #include < LITTLEFS .h>
25
+ #include < LittleFS .h>
26
26
27
27
extern File tFile_handle[ESP_MAX_OPENHANDLE];
28
28
29
29
bool ESP_FileSystem::begin ()
30
30
{
31
- _started = LITTLEFS .begin (true );
31
+ _started = LittleFS .begin (true );
32
32
return _started;
33
33
}
34
34
35
35
void ESP_FileSystem::end ()
36
36
{
37
- LITTLEFS .end ();
37
+ LittleFS .end ();
38
38
_started = false ;
39
39
}
40
40
41
41
size_t ESP_FileSystem::freeBytes ()
42
42
{
43
- return (LITTLEFS .totalBytes () - LITTLEFS .usedBytes ());
43
+ return (LittleFS .totalBytes () - LittleFS .usedBytes ());
44
44
}
45
45
46
46
size_t ESP_FileSystem::totalBytes ()
47
47
{
48
- return LITTLEFS .totalBytes ();
48
+ return LittleFS .totalBytes ();
49
49
}
50
50
51
51
size_t ESP_FileSystem::usedBytes ()
52
52
{
53
- return LITTLEFS .usedBytes ();
53
+ return LittleFS .usedBytes ();
54
54
}
55
55
56
56
uint ESP_FileSystem::maxPathLength ()
@@ -60,7 +60,7 @@ uint ESP_FileSystem::maxPathLength()
60
60
61
61
bool ESP_FileSystem::rename (const char *oldpath, const char *newpath)
62
62
{
63
- return LITTLEFS .rename (oldpath,newpath);
63
+ return LittleFS .rename (oldpath,newpath);
64
64
}
65
65
66
66
const char * ESP_FileSystem::FilesystemName ()
@@ -70,7 +70,7 @@ const char * ESP_FileSystem::FilesystemName()
70
70
71
71
bool ESP_FileSystem::format ()
72
72
{
73
- bool res = LITTLEFS .format ();
73
+ bool res = LittleFS .format ();
74
74
if (res) {
75
75
res = begin ();
76
76
}
@@ -90,7 +90,7 @@ ESP_File ESP_FileSystem::open(const char* path, uint8_t mode)
90
90
log_esp3d (" %s is invalid path" , path);
91
91
return ESP_File ();
92
92
}
93
- File tmp = LITTLEFS .open (path, (mode == ESP_FILE_READ)?FILE_READ:(mode == ESP_FILE_WRITE)?FILE_WRITE:FILE_APPEND);
93
+ File tmp = LittleFS .open (path, (mode == ESP_FILE_READ)?FILE_READ:(mode == ESP_FILE_WRITE)?FILE_WRITE:FILE_APPEND);
94
94
if (tmp) {
95
95
ESP_File esptmp (&tmp, tmp.isDirectory (),(mode == ESP_FILE_READ)?false :true , path);
96
96
log_esp3d (" %s is a %s" , path,tmp.isDirectory ()?" Dir" :" File" );
@@ -108,7 +108,7 @@ bool ESP_FileSystem::exists(const char* path)
108
108
if (strcmp (path, " /" ) == 0 ) {
109
109
return _started;
110
110
}
111
- res = LITTLEFS .exists (path);
111
+ res = LittleFS .exists (path);
112
112
if (!res) {
113
113
ESP_File root = ESP_FileSystem::open (path, ESP_FILE_READ);
114
114
if (root) {
@@ -121,7 +121,7 @@ bool ESP_FileSystem::exists(const char* path)
121
121
122
122
bool ESP_FileSystem::remove (const char *path)
123
123
{
124
- return LITTLEFS .remove (path);
124
+ return LittleFS .remove (path);
125
125
}
126
126
127
127
bool ESP_FileSystem::mkdir (const char *path)
@@ -135,7 +135,7 @@ bool ESP_FileSystem::mkdir(const char *path)
135
135
p.remove (p.length ()-1 );
136
136
}
137
137
}
138
- return LITTLEFS .mkdir (p);
138
+ return LittleFS .mkdir (p);
139
139
}
140
140
141
141
bool ESP_FileSystem::rmdir (const char *path)
@@ -157,7 +157,7 @@ bool ESP_FileSystem::rmdir(const char *path)
157
157
GenLinkedList<String > pathlist;
158
158
pathlist.push (p);
159
159
while (pathlist.count () > 0 ) {
160
- File dir = LITTLEFS .open (pathlist.getLast ().c_str ());
160
+ File dir = LittleFS .open (pathlist.getLast ().c_str ());
161
161
File f = dir.openNextFile ();
162
162
bool candelete = true ;
163
163
while (f) {
@@ -168,14 +168,14 @@ bool ESP_FileSystem::rmdir(const char *path)
168
168
f.close ();
169
169
f = File ();
170
170
} else {
171
- LITTLEFS .remove (f.name ());
171
+ LittleFS .remove (f.name ());
172
172
f.close ();
173
173
f = dir.openNextFile ();
174
174
}
175
175
}
176
176
if (candelete) {
177
177
if (pathlist.getLast () !=" /" ) {
178
- res = LITTLEFS .rmdir (pathlist.getLast ().c_str ());
178
+ res = LittleFS .rmdir (pathlist.getLast ().c_str ());
179
179
}
180
180
pathlist.pop ();
181
181
}
@@ -260,7 +260,7 @@ void ESP_File::close()
260
260
// reopen if mode = write
261
261
// udate size + date
262
262
if (_iswritemode && !_isdir) {
263
- File ftmp = LITTLEFS .open (_filename.c_str ());
263
+ File ftmp = LittleFS .open (_filename.c_str ());
264
264
if (ftmp) {
265
265
_size = ftmp.size ();
266
266
_lastwrite = ftmp.getLastWrite ();
0 commit comments