#ifndef FILESYSTEM_H #define FILESYSTEM_H 1 #include #include #include #include #include using FilesDict = std::unordered_map; using Data = std::vector; struct file_data { std::string mime; Data data; }; class Filesystem { public: Filesystem() { MagicInit(); } ~Filesystem() { MagicClose(); } bool Scan(std::string root = "./wwwroot"); bool Scan(std::string root, std::vector extensions, bool exclude_extensions = false); FilesDict & GetFiles(); void GetFilenamesSorted(std::vector & sortedFilenames); private: bool AddSingleFile(std::string path, std::string root); void MagicInit(); void MagicClose(); FilesDict m_Files; magic_t m_Magic; }; #endif