Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
JSInterface_VFS.cpp File Reference
#include "precompiled.h"
#include "JSInterface_VFS.h"
#include "lib/file/vfs/vfs_util.h"
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "ps/Filesystem.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/Object.h"
#include <algorithm>
#include <sstream>
Include dependency graph for JSInterface_VFS.cpp:

Classes

struct  JSI_VFS::BuildDirEntListState
 

Namespaces

namespace  JSI_VFS
 
namespace  JSI_VFS::PathRestriction
 

Macros

#define JS_CHECK_FILE_ERR(err)
 

Functions

template<auto & restriction>
bool JSI_VFS::PathRestrictionMet (const ScriptRequest &rq, const std::wstring &filePath)
 
static Status JSI_VFS::BuildDirEntListCB (const VfsPath &pathname, const CFileInfo &fileINfo, uintptr_t cbData)
 
template<auto & restriction>
JS::Value JSI_VFS::BuildDirEntList (const ScriptRequest &rq, const std::wstring &path, const std::wstring &filterStr, bool recurse)
 
template<auto & restriction>
bool JSI_VFS::FileExists (const ScriptRequest &rq, const std::wstring &filename)
 
double JSI_VFS::GetFileMTime (const std::wstring &filename)
 
unsigned int JSI_VFS::GetFileSize (const std::wstring &filename)
 
template<auto & restriction>
JS::Value JSI_VFS::ReadFile (const ScriptRequest &rq, const std::wstring &filename)
 
template<auto & restriction>
JS::Value JSI_VFS::ReadFileLines (const ScriptRequest &rq, const std::wstring &filename)
 
template<auto & restriction>
JS::Value JSI_VFS::ReadJSONFile (const ScriptInterface &scriptInterface, const std::wstring &filePath)
 
template<auto & restriction>
void JSI_VFS::WriteJSONFile (const ScriptInterface &scriptInterface, const std::wstring &filePath, JS::HandleValue val1)
 
bool JSI_VFS::DeleteCampaignSave (const CStrW &filePath)
 
void JSI_VFS::RegisterScriptFunctions_ReadWriteAnywhere (const ScriptRequest &rq, const u16 flags)
 
void JSI_VFS::RegisterScriptFunctions_ReadOnlySimulation (const ScriptRequest &rq, const u16 flags)
 
void JSI_VFS::RegisterScriptFunctions_ReadOnlySimulationMaps (const ScriptRequest &rq, const u16 flags)
 

Variables

constexpr std::array< std::wstring_view, 8 > JSI_VFS::PathRestriction::GUI
 
constexpr std::array< std::wstring_view, 1 > JSI_VFS::PathRestriction::SIMULATION {L"simulation/"sv}
 
constexpr std::array< std::wstring_view, 2 > JSI_VFS::PathRestriction::MAPS {L"simulation/"sv, L"maps/"sv}
 

Macro Definition Documentation

◆ JS_CHECK_FILE_ERR

#define JS_CHECK_FILE_ERR (   err)
Value:
/* this is liable to happen often, so don't complain */\
{\
return 0; \
}\
/* unknown failure. We output an error message. */\
else if (err < 0)\
LOGERROR("Unknown failure in VFS %i", err );
const Status VFS_FILE_NOT_FOUND
Definition: vfs.h:40