Add a rename(oldfilename, newfilename) method to LittleFS class

This commit is contained in:
geeksville committed 2020-05-25 10:10:06 -07:00
1 parent b03d6e5d81
commit c0c87b0dc7
2 files changed
+15

No files matched your search

@@ -195,6 +195,18 @@ bool Adafruit_LittleFS::remove (char const *filepath)
return LFS_ERR_OK == err;
}
// Rename a file
bool Adafruit_LittleFS::rename (char const *oldfilepath, char const *newfilepath)
{
_lockFS();
int err = lfs_rename(&_lfs, oldfilepath, newfilepath);
PRINT_LFS_ERR(err);
_unlockFS();
return LFS_ERR_OK == err;
}
// Remove a folder
bool Adafruit_LittleFS::rmdir (char const *filepath)
{
@@ -58,6 +58,9 @@ class Adafruit_LittleFS
// Delete the file.
bool remove (char const *filepath);
// Rename the file.
bool rename (char const *oldfilepath, char const *newfilepath);
// Delete a folder (must be empty)
bool rmdir (char const *filepath);