Renaming files sort of works.

This commit is contained in:
David Given
2022-09-07 00:02:23 +02:00
parent c1fefb7e13
commit 99ca175e9a
9 changed files with 130 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ public:
uint32_t capabilities() const
{
return OP_GETFSDATA | OP_CREATE | OP_LIST | OP_GETFILE | OP_PUTFILE |
OP_GETDIRENT;
OP_GETDIRENT | OP_MOVE;
}
std::map<std::string, std::string> getMetadata() override
@@ -188,6 +188,15 @@ public:
throwError(res);
}
void moveFile(const Path& oldPath, const Path& newPath) override
{
mount();
auto oldPathStr = oldPath.to_str();
auto newPathStr = newPath.to_str();
FRESULT res = f_rename(oldPathStr.c_str(), newPathStr.c_str());
throwError(res);
}
private:
std::shared_ptr<Dirent> toDirent(FILINFO& filinfo, const Path& parent)
{