FabGL
ESP32 Display Controller and Graphics Library
FileBrowser Class Reference

FileBrowser allows basic file system operations (dir, mkdir, remove and rename) More...

#include <fabutils.h>

Public Member Functions

void changeDirectory (const char *subdir)
 Sets relative directory path. More...
 
int count ()
 Determines number of files in current directory. More...
 
char * createTempFilename ()
 Creates a random temporary filename, with absolute path. More...
 
char const * directory ()
 Determines absolute path of current directory. More...
 
bool exists (char const *name, bool caseSensitive=true)
 Determines if a file or directory exists. More...
 
bool fileAccessDate (char const *name, int *year, int *month, int *day, int *hour, int *minutes, int *seconds)
 Gets file access date and time. More...
 
bool fileCreationDate (char const *name, int *year, int *month, int *day, int *hour, int *minutes, int *seconds)
 Gets file creation date and time. More...
 
bool filePathExists (char const *filepath)
 Determines if a file exists. More...
 
size_t fileSize (char const *name)
 Determines file size. More...
 
bool fileUpdateDate (char const *name, int *year, int *month, int *day, int *hour, int *minutes, int *seconds)
 Gets file update date and time. More...
 
DirItem const * get (int index)
 Gets file/directory at index. More...
 
DriveType getCurrentDriveType ()
 Returns the drive type of current directory. More...
 
int getFullPath (char const *name, char *outPath=nullptr, int maxlen=0)
 Composes a full file path given a relative name. More...
 
void makeDirectory (char const *dirname)
 Creates a directory. More...
 
FILE * openFile (char const *filename, char const *mode)
 Opens a file from current directory. More...
 
bool reload ()
 Reloads directory content. More...
 
void remove (char const *name)
 Removes a file or directory. More...
 
void rename (char const *oldName, char const *newName)
 Renames a file. More...
 
bool setDirectory (const char *path)
 Sets absolute directory path. More...
 
void setSorted (bool value)
 Determines if the items are sorted. More...
 
bool truncate (char const *name, size_t size)
 Truncates a file to the specified size. More...
 

Static Public Member Functions

static bool format (DriveType driveType, int drive)
 Formats SPIFFS or SD Card. More...
 
static DriveType getDriveType (char const *path)
 Returns the drive type of specified path. More...
 
static bool getFSInfo (DriveType driveType, int drive, int64_t *total, int64_t *used)
 Gets total and free space on a filesystem. More...
 
static bool mountSDCard (bool formatOnFail, char const *mountPath, size_t maxFiles=4, int allocationUnitSize=16 *1024, int MISO=16, int MOSI=17, int CLK=14, int CS=13)
 Mounts filesystem on SD Card. More...
 
static bool mountSPIFFS (bool formatOnFail, char const *mountPath, size_t maxFiles=4)
 Mounts filesystem on SPIFFS (Flash) More...
 
static bool remountSDCard ()
 Remounts SDCard filesystem, using the same parameters. More...
 
static bool remountSPIFFS ()
 Remounts SPIFFS filesystem, using the same parameters. More...
 
static void unmountSDCard ()
 Unmounts filesystem on SD Card. More...
 
static void unmountSPIFFS ()
 Unmounts filesystem on SPIFFS (Flash) More...
 

Detailed Description

FileBrowser allows basic file system operations (dir, mkdir, remove and rename)

Note: SPIFFS filenames (including fullpath) cannot exceed SPIFFS_OBJ_NAME_LEN (32 bytes) size.

Definition at line 554 of file fabutils.h.


The documentation for this class was generated from the following files: