/
DirectoryArchive.h
34 lines (26 loc) · 961 Bytes
/
DirectoryArchive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "iarchive.h"
/**
* greebo: This wraps around a certain path in the "real"
* filesystem on the user's hard drive.
*
* A real folder is treated like any other "archive" and gets
* added to the list of PK4 archives, using this class.
*/
class DirectoryArchive :
public IArchive
{
std::string _root;
// The modname for constructing the ModResource is cached here
// since changing the game paths will trigger a re-initialisation
// of the VFS anyway.
mutable std::string _modName;
public:
// Pass the root path to the constructor
DirectoryArchive(const std::string& root);
virtual ArchiveFilePtr openFile(const std::string& name) override;
virtual ArchiveTextFilePtr openTextFile(const std::string& name) override;
virtual bool containsFile(const std::string& name) override;
virtual void traverse(Visitor& visitor, const std::string& root) override;
};
typedef std::shared_ptr<DirectoryArchive> DirectoryArchivePtr;