20 #include "../../../include/esp3d_config.h"
21 #if (FILESYSTEM_FEATURE == ESP_FAT_FILESYSTEM)
22 #include "../esp_filesystem.h"
23 #include "../../../core/genLinkedList.h"
31 _started = FFat.begin();
43 return FFat.freeBytes();
48 return FFat.totalBytes();
53 return (FFat.totalBytes() - FFat.freeBytes());
58 return FFat.rename(oldpath,newpath);
84 p.remove(p.lastIndexOf(
'/') +1);
99 if (strcmp(path,
"/") == 0) {
102 res = FFat.exists(path);
114 return FFat.remove(path);
119 return FFat.mkdir(path);
131 while (pathlist.
count() > 0) {
132 File
dir = FFat.open(pathlist.
getLast().c_str());
134 bool candelete =
true;
136 if (f.isDirectory()) {
138 String newdir = f.
name();
139 pathlist.
push(newdir);
143 FFat.remove(f.name());
149 if (pathlist.
getLast() !=
"/") {
150 res = FFat.rmdir(pathlist.
getLast().c_str());
178 _iswritemode = iswritemode;
191 if (_filename ==
"/") {
195 if (_filename[_filename.length()-1] !=
'.') {
196 if (_filename[_filename.length()-2] !=
'/') {
203 if (_filename ==
"/.") {
207 if (_name.endsWith(
"/.")) {
208 _name.remove( _name.length() - 2,2);
212 if (_name[0] ==
'/') {
215 int pos = _name.lastIndexOf(
'/');
217 _name.remove( 0, pos+1);
238 if (_iswritemode && !_isdir) {
239 File ftmp = FFat.open(_filename.c_str());
242 _lastwrite = ftmp.getLastWrite();
254 if ((_index == -1) || !_isdir) {
260 log_esp3d(
"tmp name :%s %s", tmp.name(), (tmp.isDirectory())?
"isDir":
"isFile");
261 ESP_File esptmp(&tmp, tmp.isDirectory());
263 String sub = esptmp.filename();
264 sub.remove(0,_filename.length()-1);
265 int pos = sub.indexOf(
"/");
268 sub = sub.substring(0,pos);
270 String tag =
"*" + sub +
"*";
272 if (_dirlist.indexOf(tag) == -1) {
274 String fname = _filename.substring(0,_filename.length()-1) + sub +
"/.";
276 esptmp =
ESP_File(sub.c_str(), fname.c_str());
297 #endif //ESP_FAT_FILESYSTEM