| 823 | } |
| 824 | |
| 825 | int FileSystem::remove(const char* path) |
| 826 | { |
| 827 | if(isRootPath(path)) { |
| 828 | return Error::BadParam; |
| 829 | } |
| 830 | |
| 831 | // Check file is not marked read-only |
| 832 | int f = open(path, OpenFlag::Read); |
| 833 | if(f >= 0) { |
| 834 | auto smb = getMetaBuffer(f); |
| 835 | assert(smb != nullptr); |
| 836 | auto attr = smb->meta.attr; |
| 837 | close(f); |
| 838 | if(attr[FileAttribute::ReadOnly]) { |
| 839 | return Error::ReadOnly; |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | int err = SPIFFS_remove(handle(), path); |
| 844 | err = translateSpiffsError(err); |
| 845 | debug_ifserr(err, "remove('%s')", path); |
| 846 | partition.sync(); |
| 847 | return err; |
| 848 | } |
| 849 | |
| 850 | int FileSystem::fremove(FileHandle file) |
| 851 | { |
no test coverage detected