Skip to content

rmdir causes issues in SPIFFS. Fixes #4138, albeit not very cleanly #4154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 1, 2020
7 changes: 6 additions & 1 deletion libraries/FS/src/vfs_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ bool VFSImpl::rmdir(const char *path)
return false;
}

if (strcmp(_mountpoint, "/spiffs") == 0) {
log_e("rmdir is unnecessary in SPIFFS");
return false;
}

VFSFileImpl f(this, path, "r");
if(!f || !f.isDirectory()) {
if(f) {
Expand All @@ -200,7 +205,7 @@ bool VFSImpl::rmdir(const char *path)
return false;
}
sprintf(temp,"%s%s", _mountpoint, path);
auto rc = unlink(temp);
auto rc = ::rmdir(temp);
free(temp);
return rc == 0;
}
Expand Down