2015-03-17 21:59:39 +01:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_FILESYSTEMARCHIVE_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_FILESYSTEMARCHIVE_H
|
|
|
|
|
|
|
|
#include "archive.hpp"
|
2024-01-16 00:30:41 +01:00
|
|
|
#include "file.hpp"
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2024-01-16 00:30:41 +01:00
|
|
|
#include <filesystem>
|
2022-07-16 18:19:56 +02:00
|
|
|
#include <string>
|
|
|
|
|
2015-03-17 21:59:39 +01:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
|
|
|
|
class FileSystemArchiveFile : public File
|
|
|
|
{
|
|
|
|
public:
|
2022-06-19 13:28:33 +02:00
|
|
|
FileSystemArchiveFile(const std::filesystem::path& path);
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
Files::IStreamPtr open() override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path getPath() override { return mPath; }
|
2022-05-13 18:58:00 -07:00
|
|
|
|
2015-03-17 21:59:39 +01:00
|
|
|
private:
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path mPath;
|
2015-03-17 21:59:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class FileSystemArchive : public Archive
|
|
|
|
{
|
|
|
|
public:
|
2022-06-19 13:28:33 +02:00
|
|
|
FileSystemArchive(const std::filesystem::path& path);
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2023-12-17 15:20:48 +01:00
|
|
|
void listResources(FileMap& out) override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
2024-01-18 00:13:34 +01:00
|
|
|
bool contains(Path::NormalizedView file) const override;
|
2020-12-29 21:45:59 +01:00
|
|
|
|
|
|
|
std::string getDescription() const override;
|
2015-03-17 21:59:39 +01:00
|
|
|
|
|
|
|
private:
|
2024-01-18 00:13:34 +01:00
|
|
|
std::map<VFS::Path::Normalized, FileSystemArchiveFile, std::less<>> mIndex;
|
2022-06-19 13:28:33 +02:00
|
|
|
std::filesystem::path mPath;
|
2015-03-17 21:59:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|