27class NativeFileSystem;
37 const std::string&
Path()
override;
38 uint64_t
Size()
override;
40 void Read(uint8_t* buffer,
int bytes)
override;
43 uint64_t
Tell()
override;
64 std::shared_ptr<IVirtualFile>
Open(
const std::string& path,
FileModes)
override;
65 void Close(std::shared_ptr<IVirtualFile>&)
override;
66 std::shared_ptr<IVirtualDirectory>
OpenDirectory(
const std::string& dir)
override;
68 bool IsFile(
const std::string& path)
override;
70 bool Exists(
const std::string& path)
override;
83 const std::string&
GetRoot()
override;
Meant to list all the files and sub files in the directory. This is sort of a replacement for directo...
Definition: vfs.h:87
The main functionality for this is to read files, so writing to files will not really be supported.
Definition: vfs.h:41
Definition: nativevfs.h:78
friend NativeFileSystem
Definition: nativevfs.h:89
uint64_t GetSize() override
Get number of files in directory
Definition: nativevfs.cpp:138
NativeFileSystem *const nfs
Definition: nativevfs.h:92
std::vector< std::string > paths
Definition: nativevfs.h:90
std::shared_ptr< IVirtualFile > GetFile(int index, FileModes modes) override
Opens file of index.
Definition: nativevfs.cpp:142
std::string root
Definition: nativevfs.h:91
NativeDirectory(NativeFileSystem *_nfs, const std::string &_root)
Definition: nativevfs.h:80
IVirtualFileSystem * GetFileSystem() override
Get the filesystem this refers to.
Definition: nativevfs.cpp:150
const std::string & GetRoot() override
The root directory, relative to the filesystem.
Definition: nativevfs.cpp:140
const std::string & GetFilename(int index) override
Get file name relative to this directory
Definition: nativevfs.cpp:148
Definition: nativevfs.h:30
std::ifstream file
Definition: nativevfs.h:51
IVirtualFileSystem * GetFileSystem() override
Definition: nativevfs.h:45
uint64_t Tell() override
Get current file position
Definition: nativevfs.cpp:136
bool Seek(long offset, Offset origin) override
Goto position of file, offset away from origin
Definition: nativevfs.cpp:119
NativeFile(NativeFileSystem *_nfs, const std::string &file)
Definition: nativevfs.h:33
friend NativeFileSystem
Definition: nativevfs.h:47
std::string path
Definition: nativevfs.h:50
void Read(uint8_t *buffer, int bytes) override
Reads num_bytes of bytes into buffer. Frees memory for the number
Definition: nativevfs.cpp:113
NativeFile(NativeFileSystem *_nfs)
Definition: nativevfs.h:32
NativeFileSystem *const nfs
Definition: nativevfs.h:54
uint64_t Size() override
Size of file in bytes
Definition: nativevfs.cpp:111
~NativeFile()
Definition: nativevfs.h:35
const std::string & Path() override
Get file path relative to the filesystem.
Definition: nativevfs.cpp:109
int size
Definition: nativevfs.h:52
Definition: nativevfs.h:57
friend NativeDirectory
Definition: nativevfs.h:75
NativeFileSystem(std::string root)
Definition: nativevfs.cpp:28
std::shared_ptr< IVirtualDirectory > OpenDirectory(const std::string &dir) override
Lists all the files in the directory. Does not list directories in the list because for our purposes,...
Definition: nativevfs.cpp:68
void Close(std::shared_ptr< IVirtualFile > &) override
Definition: nativevfs.cpp:62
bool Initialize() override
Definition: nativevfs.h:62
std::string root
Definition: nativevfs.h:74
bool Exists(const std::string &path) override
Does the file exist
Definition: nativevfs.cpp:105
~NativeFileSystem()=default
bool IsDirectory(const std::string &path) override
Is the file a directory </summary
Definition: nativevfs.cpp:101
bool IsFile(const std::string &path) override
Is the file a file
Definition: nativevfs.cpp:97
const std::string & GetRoot()
Definition: nativevfs.h:71
std::shared_ptr< IVirtualFile > Open(const std::string &path, FileModes) override
Opens file from the filesystem. Returns nullptr if file is invalid
Definition: nativevfs.cpp:30
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: asset.h:29
Offset
Definition: vfs.h:30
FileModes
Definition: vfs.h:25
glm::vec3 offset
Definition: starsystemview.cpp:91