Changeset View
Changeset View
Standalone View
Standalone View
source/ps/scripting/JSInterface_VFS.cpp
Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | bool JSI_VFS::PathRestrictionMet(ScriptInterface::CxPrivate* pCxPrivate, const std::vector<CStrW>& validPaths, const CStrW& filePath) | ||||
for (std::size_t i = 0; i < validPaths.size(); ++i) | for (std::size_t i = 0; i < validPaths.size(); ++i) | ||||
{ | { | ||||
if (i != 0) | if (i != 0) | ||||
allowedPaths += L", "; | allowedPaths += L", "; | ||||
allowedPaths += L"\"" + validPaths[i] + L"\""; | allowedPaths += L"\"" + validPaths[i] + L"\""; | ||||
} | } | ||||
JS_ReportError( | JSContext* cx = pCxPrivate->pScriptInterface->GetContext(); | ||||
pCxPrivate->pScriptInterface->GetContext(), | JSAutoRequest rq(cx); | ||||
"This part of the engine may only read from %s!", | JS_ReportError(cx, "This part of the engine may only read from %s!", utf8_from_wstring(allowedPaths).c_str()); | ||||
utf8_from_wstring(allowedPaths).c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
#define VFS_ScriptFunctions(context)\ | #define VFS_ScriptFunctions(context)\ | ||||
JS::Value Script_ReadJSONFile_##context(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& filePath)\ | JS::Value Script_ReadJSONFile_##context(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& filePath)\ | ||||
{\ | {\ | ||||
return JSI_VFS::ReadJSONFile(pCxPrivate, PathRestriction_##context, filePath);\ | return JSI_VFS::ReadJSONFile(pCxPrivate, PathRestriction_##context, filePath);\ | ||||
Show All 40 Lines |
Wildfire Games · Phabricator