1#ifndef OE_IO_FILE_SYSTEM_H 
    2#define OE_IO_FILE_SYSTEM_H 
    5#include "../util/byte_array.h" 
   74            bool mount(
const std::filesystem::path& real_path, 
const std::filesystem::path& mount_path, 
const bool& append = 
true);
 
   79            bool unmount(
const std::string& real_path);
 
   86            bool mkdir(
const std::string& path);
 
   93            bool isDir(
const std::string& path) 
const noexcept;
 
   98            bool remove(
const std::string& path);
 
  139            std::filesystem::path 
getRealPath(
const std::filesystem::path& path) 
const noexcept;
 
  150            std::filesystem::space_info 
getDiskSpace(
const std::filesystem::path& path) 
const noexcept;
 
  170            std::vector<std::string> 
scandir(
const std::filesystem::path& directory) 
const;
 
  184            std::string 
getFilename(
const std::string& partial_path, 
const std::vector<std::string>& allowed_suffixes);
 
  186            std::string getBaseDir();
 
  197            std::string 
generatePrefDir(
const std::string& organization, 
const std::string& application);
 
 
Virtual file system wrapper.
Definition file_system.h:61
bool isDir(const std::string &path) const noexcept
Check if the path points a dir in the virtual file system.
size_t getLastModificationTime(const std::string &filename) const noexcept
Get a file last modification time in UNIX timestamp.
std::string generatePrefDir(const std::string &organization, const std::string &application)
Get (and create if not already exists) the 'pref dir' where users can write personal files (preferenc...
std::vector< std::string > scandir(const std::filesystem::path &directory) const
Return list of filenames contained in the directory.
bool mount(const std::filesystem::path &real_path, const std::filesystem::path &mount_path, const bool &append=true)
Add an archive or a folder into the virtual file hierarchy.
size_t getFileSize(const std::string &filename) const noexcept
Get a file size in bytes.
std::string getFilename(const std::string &partial_path, const std::vector< std::string > &allowed_suffixes)
Get file location from partial filename without extension and a list of allowed suffixes.
FileSystemError getLastErrorCode() const noexcept
Get last error code.
FileSystem(const char *argv0=nullptr)
Creates a file system.
ByteArray readFile(const std::string &filename)
Read binary file into a ByteArray.
bool unmount(const std::string &real_path)
Remove a previously mounted folder/archive.
std::string readTextFile(const std::string &filename)
Read textual file into a string.
bool mkdir(const std::string &path)
Create a new folder.
std::filesystem::path getRealPath(const std::filesystem::path &path) const noexcept
Get actual folder on the disk where is stored the file/folder in virtual path.
bool fileExists(const std::string &filename) const noexcept
Check if a file exists.
bool remove(const std::string &path)
Remove a file.
std::filesystem::space_info getDiskSpace(const std::filesystem::path &path) const noexcept
Get space information about the disk on which the virtual path is located.
std::string getWritePath() const
Get the path used for writing.
size_t getLastAccessTime(const std::string &filename) const noexcept
Get a file last access time in UNIX timestamp.
std::string getLastError() const noexcept
Get last error description.
bool setWritePath(const std::string &real_path)
Bind a path on the actual disk where write is allowed if real_path not exists, it is recursively crea...
Input/Output abstractions (Filesystem, Network, ...)
Definition file.h:14
FileSystemError
FileSystem error.
Definition file_system.h:20