Skip to content

Commit e151d5b

Browse files
committed
rmdir causes issues in SPIFFS. Fixes espressif#4138, albeit not very cleanly
1 parent b92c58d commit e151d5b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: libraries/FS/src/vfs_api.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,16 @@ bool VFSImpl::rmdir(const char *path)
183183
log_e("File system is not mounted");
184184
return false;
185185
}
186-
187186
VFSFileImpl f(this, path, "r");
188-
if(!f || !f.isDirectory()) {
187+
if(!f || !f.isDirectory() || _mountpoint == "/spiffs") {
188+
if (_mountpoint == "/spiffs") {
189+
log_e("rmdir is unnecessary in SPIFFS");
190+
} else {
191+
log_e("%s does not exists or is a file", path);
192+
}
189193
if(f) {
190194
f.close();
191195
}
192-
log_e("%s does not exists or is a file", path);
193196
return false;
194197
}
195198
f.close();
@@ -200,7 +203,7 @@ bool VFSImpl::rmdir(const char *path)
200203
return false;
201204
}
202205
sprintf(temp,"%s%s", _mountpoint, path);
203-
auto rc = unlink(temp);
206+
auto rc = rmdir(temp);
204207
free(temp);
205208
return rc == 0;
206209
}

0 commit comments

Comments
 (0)