Core/FileSystem.h File Reference
#include <IFS/Helpers.h>
#include <IFS/File.h>
#include <IFS/Directory.h>
#include <Spiffs.h>
Include dependency graph for Core/FileSystem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 SmingInternal
 

Macros

#define CHECK_FS(_method)
 

Typedefs

using file_t = IFS::FileHandle
 
using FileHandle = IFS::FileHandle
 
using DirHandle = IFS::DirHandle
 
using FileOpenFlag = IFS::OpenFlag
 
using FileOpenFlags = IFS::OpenFlags
 
using FileAttribute = IFS::FileAttribute
 
using FileAttributes = IFS::FileAttributes
 
using FileStat = IFS::Stat
 
using FileNameStat = IFS::NameStat
 
using File = IFS::File
 
using Directory = IFS::Directory
 

Functions

IFS::FileSystemgetFileSystem ()
 Get the currently active file system, if any. More...
 
void fileSetFileSystem (IFS::IFileSystem *fileSystem)
 Sets the currently active file system. More...
 
void fileFreeFileSystem ()
 
bool fileMountFileSystem (IFS::IFileSystem *fs)
 Mount a constructed filesystem with debug messages. More...
 
bool fwfs_mount ()
 Mount the first available FWFS volume. More...
 
bool fwfs_mount (Storage::Partition partition)
 Mount SPIFFS volume from a specific partition. More...
 
IFS::FileSystemfileMountArchive (const String &filename)
 Mount a backup archive. More...
 
template<typename T >
FileHandle fileOpen (const T &path, FileOpenFlags flags=File::ReadOnly)
 Open file by path. More...
 
int fileClose (FileHandle file)
 Clode file. More...
 
int fileWrite (FileHandle file, const void *data, size_t size)
 Write to file. More...
 
int fileTouch (FileHandle file)
 Update file modification time. More...
 
int fileRead (FileHandle file, void *data, size_t size)
 Read from file. More...
 
file_offset_t fileSeek (FileHandle file, file_offset_t offset, SeekOrigin origin)
 Position file cursor. More...
 
bool fileIsEOF (FileHandle file)
 Check if at end of file. More...
 
file_offset_t fileTell (FileHandle file)
 Get position in file. More...
 
int fileFlush (FileHandle file)
 Flush pending writes. More...
 
String fileGetErrorString (int err)
 get the text for a returned error code More...
 
template<typename TFileName >
int fileSetContent (const TFileName &fileName, const char *content, size_t length)
 Create or replace file with defined content. More...
 
template<typename TFileName , typename TContent >
int fileSetContent (const TFileName &fileName, TContent content)
 
template<typename TFileName >
file_size_t fileGetSize (const TFileName &fileName)
 Get size of file. More...
 
int fileTruncate (FileHandle file, file_size_t newSize)
 Truncate (reduce) the size of an open file. More...
 
int fileTruncate (FileHandle file)
 Truncate an open file at the current cursor position. More...
 
template<typename TFileName >
int fileTruncate (const TFileName &fileName, file_size_t newSize)
 Truncate (reduce) the size of a file. More...
 
int fileRename (const char *oldName, const char *newName)
 Rename file. More...
 
int fileRename (const String &oldName, const String &newName)
 
template<typename TFileName >
String fileGetContent (const TFileName &fileName)
 Read content of a file. More...
 
template<typename TFileName >
size_t fileGetContent (const TFileName &fileName, char *buffer, size_t bufSize)
 Read content of a file. More...
 
template<typename TFileName >
size_t fileGetContent (const TFileName &fileName, char *buffer)
 
int fileStats (const char *fileName, FileStat &stat)
 Get file statistics. More...
 
int fileStats (const String &fileName, FileStat &stat)
 
int fileStats (FileHandle file, FileStat &stat)
 
int fileDelete (const char *fileName)
 Delete file. More...
 
int fileDelete (const String &fileName)
 
int fileDelete (FileHandle file)
 Delete file. More...
 
bool fileExist (const char *fileName)
 Check if a file exists on file system. More...
 
bool fileExist (const String &fileName)
 
bool dirExist (const char *dirName)
 Check if a directory exists on file system. More...
 
bool dirExist (const String &dirName)
 
int fileOpenDir (const char *dirName, DirHandle &dir)
 Open a named directory for reading. More...
 
int fileOpenDir (const String &dirName, DirHandle &dir)
 
int fileOpenRootDir (DirHandle &dir)
 
int fileCloseDir (DirHandle dir)
 close a directory object More...
 
int fileReadDir (DirHandle dir, FileStat &stat)
 Read a directory entry. More...
 
int fileRewindDir (DirHandle dir)
 Rewind to start of directory entries. More...
 
int fileGetSystemInfo (IFS::FileSystem::Info &info)
 Get basic file system information. More...
 
IFS::FileSystem::Type fileSystemType ()
 Get the type of file system currently mounted (if any) More...
 
int fileSystemFormat ()
 Format the active file system. More...
 
int fileSystemCheck ()
 Perform a consistency check/repair on the active file system. More...
 
int fileSetACL (FileHandle file, const IFS::ACL &acl)
 Set access control information. More...
 
template<typename T >
int fileSetAttr (const T &filename, FileAttributes attr)
 Set file attributes. More...
 
int fileSetTime (FileHandle file, time_t mtime)
 Set access control information for file. More...
 
template<typename T >
int createDirectory (const T &path)
 Create a directory. More...
 
template<typename T >
int createDirectories (const T &path)
 Create a directory and all required parent directories. More...
 

Variables

constexpr int FS_OK = IFS::FS_OK
 
IFS::FileSystemSmingInternal::activeFileSystem
 Global file system instance. More...