I’m running into a problem using the flash file system. My goal is to “update” a small file by deleting it first and then rewriting the new contents. The problem I’m running into is that eraseFile won’t work because it requires the file to be closed. Even though I have explicitly closed the file, the system continues to report it as open.
The action is happening inside of a class, but I wouldn’t think that matters.
Here is the code:
File system created globally in main program
sffs <- SPIFlashFileSystem(0x000000, 0x50000)
Then, inside a class function:
server.log("File open? " + sffs.isFileOpen("wifi_list.nv")) //reports true local nv_wifi = sffs.open("wifi_list.nv","r") server.log(nv_wifi.read()) //just to verify the contents are being read nv_wifi.close() server.log("File open? " + sffs.isFileOpen("wifi_list.nv")) //still reports true sffs.eraseFile("wifi_list.nv") //reports error: Cannot perform operation with file(s) open