mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
[FL-3327] Storage: common_rename is now POSIX compliant (#2693)
* Storage: common_rename is now POSIX compliant * storage: check for success on storage_common_remove in file rename --------- Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
@@ -422,7 +422,16 @@ FS_Error storage_common_remove(Storage* storage, const char* path) {
|
||||
}
|
||||
|
||||
FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) {
|
||||
FS_Error error = storage_common_copy(storage, old_path, new_path);
|
||||
FS_Error error;
|
||||
|
||||
if(storage_file_exists(storage, new_path)) {
|
||||
error = storage_common_remove(storage, new_path);
|
||||
if(error != FSE_OK) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
error = storage_common_copy(storage, old_path, new_path);
|
||||
if(error == FSE_OK) {
|
||||
if(!storage_simply_remove_recursive(storage, old_path)) {
|
||||
error = FSE_INTERNAL;
|
||||
|
||||
Reference in New Issue
Block a user