mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Unify two rmgen and GUI JSON file loading script functions, refs #4868.
Revert the introduction of the exact copies of FileExists ReadJSONFile functions in MapGenerator.cpp introduced by871ed04521. Include JSInterface_VFS.cpp from MapGenerator.cpp to remove that code while gaining the other missing VFS file loading functions in rmgen/. Split RegisterScriptFunctions of JSInterface_VFS.cpp fromeb4e66aab3into RegisterReadOnlyScriptFunctions and RegisterWriteScriptFunctions to prevent unintentional write access. This was SVN commit r20507.
This commit is contained in:
@@ -203,7 +203,7 @@ void JSI_VFS::WriteJSONFile(ScriptInterface::CxPrivate* pCxPrivate, const std::w
|
||||
g_VFS->CreateFile(path, buf.Data(), buf.Size());
|
||||
}
|
||||
|
||||
void JSI_VFS::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
void JSI_VFS::RegisterReadOnlyScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, std::wstring, bool, &JSI_VFS::BuildDirEntList>("BuildDirEntList");
|
||||
scriptInterface.RegisterFunction<bool, CStrW, JSI_VFS::FileExists>("FileExists");
|
||||
@@ -212,5 +212,9 @@ void JSI_VFS::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, &JSI_VFS::ReadFile>("ReadFile");
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, &JSI_VFS::ReadFileLines>("ReadFileLines");
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, &ReadJSONFile>("ReadJSONFile");
|
||||
}
|
||||
|
||||
void JSI_VFS::RegisterWriteScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &WriteJSONFile>("WriteJSONFile");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user