Skip to content

Commit

Permalink
feat: allow deleting directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex4386 committed Jun 9, 2024
1 parent daa1063 commit 4b6edc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If your computer can handle Android devices, it should be able to handle Flipper
- Large file transfer now **WORKS**!
- It didn't work since the header did not have proper `size` defined, ignoring the further packets.
- Now utilizing even less memory via `streaming` support!
* Deleting Files
* Deleting Files/Directories

### Known Issues
* Creating directories, files, uploading files are not supported yet.
Expand Down
17 changes: 12 additions & 5 deletions src/scenes/mtp/mtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,12 +1113,19 @@ bool DeleteObject(AppMTP* mtp, uint32_t handle) {
return false;
}

if(!storage_file_exists(mtp->storage, path)) {
return false;
}
FileInfo fileinfo;
FS_Error err = storage_common_stat(mtp->storage, path, &fileinfo);

if(storage_common_remove(mtp->storage, path) != FSE_OK) {
return false;
if(err != FSE_OK) {
if(file_info_is_dir(&fileinfo)) {
if(storage_dir_remove(mtp->storage, path) != FSE_OK) {

Check failure on line 1121 in src/scenes/mtp/mtp.c

View workflow job for this annotation

GitHub Actions / Nightly Build for (Unleashed) Development channel

implicit declaration of function 'storage_dir_remove'; did you mean 'storage_dir_rewind'? [-Werror=implicit-function-declaration]
return false;
}
} else {
if(storage_common_remove(mtp->storage, path) != FSE_OK) {
return false;
}
}
}

return true;
Expand Down

0 comments on commit 4b6edc8

Please sign in to comment.