SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
fspp::FileSystem Class Reference

#include <fspp.h>

Public Types

using SearchPathMapDir = std::unordered_map< std::string, std::vector< std::string > >
 
using SearchPathMapVPK = std::unordered_map< std::string, std::vector< std::unique_ptr< vpkpp::PackFile > > >
 

Public Member Functions

const SearchPathMapDirgetSearchPathDirs () const
 
SearchPathMapDirgetSearchPathDirs ()
 
const SearchPathMapVPKgetSearchPathVPKs () const
 
SearchPathMapVPKgetSearchPathVPKs ()
 
std::optional< std::vector< std::byte > > read (std::string_view filePath, std::string_view searchPath="GAME", bool prioritizeVPKs=true) const
 
std::optional< std::vector< std::byte > > readForMap (const vpkpp::PackFile *map, std::string_view filePath, std::string_view searchPath="GAME", bool prioritizeVPKs=true) const
 

Static Public Member Functions

static std::optional< FileSystemload (steampp::AppID appID, std::string_view gameID, const FileSystemOptions &options={})
 Creates a FileSystem based on a Steam installation.
 
static std::optional< FileSystemload (std::string_view gamePath, const FileSystemOptions &options={})
 Creates a FileSystem based on a local installation.
 

Protected Member Functions

 FileSystem (std::string_view gamePath, const FileSystemOptions &options={})
 

Detailed Description

Definition at line 32 of file fspp.h.

Member Typedef Documentation

◆ SearchPathMapDir

using fspp::FileSystem::SearchPathMapDir = std::unordered_map<std::string, std::vector<std::string> >

Definition at line 34 of file fspp.h.

◆ SearchPathMapVPK

using fspp::FileSystem::SearchPathMapVPK = std::unordered_map<std::string, std::vector<std::unique_ptr<vpkpp::PackFile> >>

Definition at line 35 of file fspp.h.

Constructor & Destructor Documentation

◆ FileSystem()

FileSystem::FileSystem ( std::string_view  gamePath,
const FileSystemOptions options = {} 
)
explicitprotected

Definition at line 42 of file fspp.cpp.

Member Function Documentation

◆ getSearchPathDirs() [1/2]

FileSystem::SearchPathMapDir & FileSystem::getSearchPathDirs ( )

Definition at line 188 of file fspp.cpp.

◆ getSearchPathDirs() [2/2]

const FileSystem::SearchPathMapDir & FileSystem::getSearchPathDirs ( ) const

Definition at line 184 of file fspp.cpp.

◆ getSearchPathVPKs() [1/2]

FileSystem::SearchPathMapVPK & FileSystem::getSearchPathVPKs ( )

Definition at line 196 of file fspp.cpp.

◆ getSearchPathVPKs() [2/2]

const FileSystem::SearchPathMapVPK & FileSystem::getSearchPathVPKs ( ) const

Definition at line 192 of file fspp.cpp.

◆ load() [1/2]

std::optional< FileSystem > FileSystem::load ( std::string_view  gamePath,
const FileSystemOptions options = {} 
)
static

Creates a FileSystem based on a local installation.

Parameters
gamePathThe full path to the directory where gameinfo.txt is located (e.g. "path/to/portal2")
optionsFileSystem creation options
Returns
The created FileSystem if gameinfo.txt is found

Definition at line 35 of file fspp.cpp.

◆ load() [2/2]

std::optional< FileSystem > FileSystem::load ( steampp::AppID  appID,
std::string_view  gameID,
const FileSystemOptions options = {} 
)
static

Creates a FileSystem based on a Steam installation.

Parameters
appIDThe AppID of the base game
gameIDThe name of the directory where gameinfo.txt is located (e.g. "portal2")
optionsFileSystem creation options
Returns
The created FileSystem if the specified Steam game is installed

Definition at line 27 of file fspp.cpp.

◆ read()

std::optional< std::vector< std::byte > > FileSystem::read ( std::string_view  filePath,
std::string_view  searchPath = "GAME",
bool  prioritizeVPKs = true 
) const

Definition at line 200 of file fspp.cpp.

◆ readForMap()

std::optional< std::vector< std::byte > > FileSystem::readForMap ( const vpkpp::PackFile map,
std::string_view  filePath,
std::string_view  searchPath = "GAME",
bool  prioritizeVPKs = true 
) const

Definition at line 238 of file fspp.cpp.


The documentation for this class was generated from the following files: