Changeset View
Changeset View
Standalone View
Standalone View
source/ps/scripting/JSInterface_VFS.h
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | |||||||
StanUnsubmitted Not Done Inline Actions
Stan: | ||||||||
Not Done Inline ActionsDon't forget these ^^ Freagarach: Don't forget these ^^ | ||||||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | |||||||
* | * | |||||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | |||||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | |||||||
* (at your option) any later version. | * (at your option) any later version. | |||||||
* | * | |||||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | |||||||
Show All 32 Lines | namespace JSI_VFS | |||||||
JS::Value ReadFileLines(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& filename); | JS::Value ReadFileLines(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& filename); | |||||||
// Return file contents parsed as a JS Object | // Return file contents parsed as a JS Object | |||||||
JS::Value ReadJSONFile(ScriptInterface::CmptPrivate* pCmptPrivate, const std::vector<CStrW>& validPaths, const CStrW& filePath); | JS::Value ReadJSONFile(ScriptInterface::CmptPrivate* pCmptPrivate, const std::vector<CStrW>& validPaths, const CStrW& filePath); | |||||||
// Save given JS Object to a JSON file | // Save given JS Object to a JSON file | |||||||
void WriteJSONFile(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& filePath, JS::HandleValue val1); | void WriteJSONFile(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& filePath, JS::HandleValue val1); | |||||||
// Delete the given campaign save. | ||||||||
// This is limited to campaign save to avoid mods deleting the wrong file. | ||||||||
bool DeleteCampaignSave(ScriptInterface::CmptPrivate* pCmptPrivate, const CStrW& filePath); | ||||||||
// Tests whether the current script context is allowed to read from the given directory | // Tests whether the current script context is allowed to read from the given directory | |||||||
bool PathRestrictionMet(ScriptInterface::CmptPrivate* pCmptPrivate, const std::vector<CStrW>& validPaths, const CStrW& filePath); | bool PathRestrictionMet(ScriptInterface::CmptPrivate* pCmptPrivate, const std::vector<CStrW>& validPaths, const CStrW& filePath); | |||||||
void RegisterScriptFunctions_GUI(const ScriptInterface& scriptInterface); | void RegisterScriptFunctions_GUI(const ScriptInterface& scriptInterface); | |||||||
void RegisterScriptFunctions_Simulation(const ScriptInterface& scriptInterface); | void RegisterScriptFunctions_Simulation(const ScriptInterface& scriptInterface); | |||||||
void RegisterScriptFunctions_Maps(const ScriptInterface& scriptInterface); | void RegisterScriptFunctions_Maps(const ScriptInterface& scriptInterface); | |||||||
} | } | |||||||
#endif // INCLUDED_JSI_VFS | #endif // INCLUDED_JSI_VFS |
Wildfire Games · Phabricator