mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 13:03:13 +00:00
ffa3996a5e
* clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく <alleteam@gmail.com>
79 lines
1.5 KiB
C
79 lines
1.5 KiB
C
#pragma once
|
|
#include <storage/storage.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct DirWalk DirWalk;
|
|
|
|
typedef enum {
|
|
DirWalkOK, /**< OK */
|
|
DirWalkError, /**< Error */
|
|
DirWalkLast, /**< Last element */
|
|
} DirWalkResult;
|
|
|
|
typedef bool (*DirWalkFilterCb)(const char* name, FileInfo* fileinfo, void* ctx);
|
|
|
|
/**
|
|
* Allocate DirWalk
|
|
* @param storage
|
|
* @return DirWalk*
|
|
*/
|
|
DirWalk* dir_walk_alloc(Storage* storage);
|
|
|
|
/**
|
|
* Free DirWalk
|
|
* @param dir_walk
|
|
*/
|
|
void dir_walk_free(DirWalk* dir_walk);
|
|
|
|
/**
|
|
* Set recursive mode (true by default)
|
|
* @param dir_walk
|
|
* @param recursive
|
|
*/
|
|
void dir_walk_set_recursive(DirWalk* dir_walk, bool recursive);
|
|
|
|
/**
|
|
* Set filter callback (Should return true if the data is valid)
|
|
* @param dir_walk
|
|
* @param cb
|
|
* @param context
|
|
*/
|
|
void dir_walk_set_filter_cb(DirWalk* dir_walk, DirWalkFilterCb cb, void* context);
|
|
|
|
/**
|
|
* Open directory
|
|
* @param dir_walk
|
|
* @param path
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool dir_walk_open(DirWalk* dir_walk, const char* path);
|
|
|
|
/**
|
|
* Get error id
|
|
* @param dir_walk
|
|
* @return FS_Error
|
|
*/
|
|
FS_Error dir_walk_get_error(DirWalk* dir_walk);
|
|
|
|
/**
|
|
* Read next element from directory
|
|
* @param dir_walk
|
|
* @param return_path
|
|
* @param fileinfo
|
|
* @return DirWalkResult
|
|
*/
|
|
DirWalkResult dir_walk_read(DirWalk* dir_walk, FuriString* return_path, FileInfo* fileinfo);
|
|
|
|
/**
|
|
* Close directory
|
|
* @param dir_walk
|
|
*/
|
|
void dir_walk_close(DirWalk* dir_walk);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|