mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-27 15:22:29 +03:00
4bf29827f8
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <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 |