20 #include "../../../include/esp3d_config.h"
21 #if (FILESYSTEM_FEATURE == ESP_SPIFFS_FILESYSTEM) && defined(ARDUINO_ARCH_ESP32)
22 #include "../esp_filesystem.h"
23 #include "../../../core/genLinkedList.h"
30 _started = SPIFFS.begin(
true);
46 return SPIFFS.totalBytes();
51 return SPIFFS.usedBytes();
56 return SPIFFS.rename(oldpath,newpath);
66 return SPIFFS.format();
89 if (strcmp(path,
"/") == 0) {
94 if (spath[spath.length()-1] ==
'/') {
96 spath.remove(spath.length()-1);
99 res = SPIFFS.exists(spath.c_str());
101 String newpath = spath;
102 if (newpath[newpath.length()-1] !=
'/') {
107 res = SPIFFS.exists(newpath);
126 return SPIFFS.remove(path);
133 if (p[p.length()-1] !=
'/') {
151 if (spath[spath.length()-1] ==
'/') {
153 spath.remove(spath.length()-1);
156 log_esp3d(
"Deleting : %s",spath.c_str());
157 File ftmp = SPIFFS.open(spath.c_str());
159 File pfile = ftmp.openNextFile();
162 if (!SPIFFS.remove(pfile.name())) {
167 pfile = ftmp.openNextFile();
193 _iswritemode = iswritemode;
206 if (_filename ==
"/") {
210 if (_filename[_filename.length()-1] !=
'.') {
211 if (_filename[_filename.length()-2] !=
'/') {
218 if (_filename ==
"/.") {
222 if (_name.endsWith(
"/.")) {
223 _name.remove( _name.length() - 2,2);
227 if (_name[0] ==
'/') {
230 int pos = _name.lastIndexOf(
'/');
232 _name.remove( 0, pos+1);
253 if (_iswritemode && !_isdir) {
254 File ftmp = SPIFFS.open(_filename.c_str());
257 _lastwrite = ftmp.getLastWrite();
269 if ((_index == -1) || !_isdir) {
276 ESP_File esptmp(&tmp, tmp.isDirectory());
279 sub.remove(0,_filename.length()-1);
280 int pos = sub.indexOf(
"/");
283 sub = sub.substring(0,pos);
285 String tag =
"*" + sub +
"*";
287 if (_dirlist.indexOf(tag) == -1) {
289 String fname = _filename.substring(0,_filename.length()-1) + sub +
"/.";
291 esptmp =
ESP_File(sub.c_str(), fname.c_str());
311 #endif //ESP_SPIFFS_FILESYSTEM