FileBrowser allows basic file system operations (dir, mkdir, remove and rename)
More...
#include <fabutils.h>
FileBrowser allows basic file system operations (dir, mkdir, remove and rename)
◆ changeDirectory()
void fabgl::FileBrowser::changeDirectory |
( |
const char * |
subdir | ) |
|
Sets relative directory path.
- Parameters
-
subdir | Relative directory path (ie "subdir") |
◆ count()
int fabgl::FileBrowser::count |
( |
| ) |
|
|
inline |
Determines number of files in current directory.
- Returns
- Number of directory files, included parent ".."
◆ directory()
char const* fabgl::FileBrowser::directory |
( |
| ) |
|
|
inline |
Determines absolute path of current directory.
- Returns
- Absolute path of current directory
◆ exists()
bool fabgl::FileBrowser::exists |
( |
char const * |
name | ) |
|
Determines if a file exists.
- Parameters
-
name | Relative file or directory name |
- Returns
- True if the file exists
◆ get()
DirItem const* fabgl::FileBrowser::get |
( |
int |
index | ) |
|
|
inline |
Gets file/directory at index.
- Parameters
-
index | File or directory index. 0 = is always parent directory |
- Returns
- File or directory specificator
◆ getFullPath()
int fabgl::FileBrowser::getFullPath |
( |
char const * |
name, |
|
|
char * |
outPath = nullptr , |
|
|
int |
maxlen = 0 |
|
) |
| |
Compose a full file path given a relative name.
- Parameters
-
name | Relative file name |
outPath | Where to place the full path. This can be NULL (used to calculate required buffer size). |
maxlen | Maximum size of outPath string. This can be 0 when outPath is NULL. |
- Returns
- Required outPath size
◆ makeDirectory()
void fabgl::FileBrowser::makeDirectory |
( |
char const * |
dirname | ) |
|
Creates a directory.
- Parameters
-
dirname | Relative directory name |
◆ reload()
void fabgl::FileBrowser::reload |
( |
| ) |
|
Reloads directory content.
◆ remove()
void fabgl::FileBrowser::remove |
( |
char const * |
name | ) |
|
Removes a file or directory.
If filesystem is SPIFFS then this method can also remove a non empty directory
- Parameters
-
name | Relative file or directory name |
◆ rename()
void fabgl::FileBrowser::rename |
( |
char const * |
oldName, |
|
|
char const * |
newName |
|
) |
| |
Renames a file.
- Parameters
-
oldName | Relative old file name |
newName | Relative new file name |
◆ setDirectory()
void fabgl::FileBrowser::setDirectory |
( |
const char * |
path | ) |
|
Sets absolute directory path.
- Parameters
-
path | Absolute directory path (ie "/spiffs") |
◆ setSorted()
void fabgl::FileBrowser::setSorted |
( |
bool |
value | ) |
|
Determines if the items are sorted.
- Parameters
-
value | If true items will be sorted in ascending order (directories first) |
The documentation for this class was generated from the following files: