Skip to content

Commit

Permalink
[FL-3662] Do not remove file when renaming to itself (#3193)
Browse files Browse the repository at this point in the history
* Do not allow overwriting a file with dir and support renaming file to itself
* Fix operator precedence error
* Add support for storage-specific path equivalence checks
* Fix typo
* Fix updater compilation
* Update Doxygen comments in storage.h

Co-authored-by: Aleksandr Kutuzov <[email protected]>
  • Loading branch information
gsurkov and skotopes authored Nov 15, 2023
1 parent 615a147 commit ba07406
Show file tree
Hide file tree
Showing 9 changed files with 507 additions and 215 deletions.
8 changes: 8 additions & 0 deletions applications/services/storage/filesystem_api_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ typedef struct {
* @param total_space pointer to total space value
* @param free_space pointer to free space value
* @return FS_Error error info
*
* @var FS_Common_Api::equivalent_path
* @brief Test whether two paths are equivalent (e.g differing case on a case-insensitive fs)
* @param path1 first path to be compared
* @param path2 second path to be compared
* @param truncate if set to true, compare only up to the path1's length
* @return true if path1 and path2 are considered equivalent
*/
typedef struct {
FS_Error (*const stat)(void* context, const char* path, FileInfo* fileinfo);
Expand All @@ -175,6 +182,7 @@ typedef struct {
const char* fs_path,
uint64_t* total_space,
uint64_t* free_space);
bool (*const equivalent_path)(const char* path1, const char* path2);
} FS_Common_Api;

/** Full filesystem api structure */
Expand Down
Loading

0 comments on commit ba07406

Please sign in to comment.