forked from 0ad/0ad
FileExists -> VfsFileExists (see next commit)
scriptInterface: fix bool cast warning This was SVN commit r8984.
This commit is contained in:
parent
77fe5c9e40
commit
d805ef356e
@ -204,7 +204,7 @@ VfsPath CColladaManager::GetLoadableFilename(const VfsPath& pathnameNoExtension,
|
||||
// be "psa" too.)
|
||||
|
||||
VfsPath dae(fs::change_extension(pathnameNoExtension, L".dae"));
|
||||
if (! FileExists(dae))
|
||||
if (! VfsFileExists(dae))
|
||||
{
|
||||
// No .dae - got to use the .pmd, assuming there is one
|
||||
return fs::change_extension(pathnameNoExtension, extn);
|
||||
@ -252,7 +252,7 @@ VfsPath CColladaManager::GetLoadableFilename(const VfsPath& pathnameNoExtension,
|
||||
cachedPmdVfsPath = fs::change_extension(cachedPmdVfsPath, extension);
|
||||
|
||||
// If it's not in the cache, we'll have to create it first
|
||||
if (! FileExists(cachedPmdVfsPath))
|
||||
if (! VfsFileExists(cachedPmdVfsPath))
|
||||
{
|
||||
if (! m->Convert(dae, cachedPmdVfsPath, type))
|
||||
return L""; // failed to convert
|
||||
|
@ -77,7 +77,7 @@ void CMapReader::LoadMap(const VfsPath& pathname, CTerrain *pTerrain_,
|
||||
// mostly-empty .pmp file, so we let the XML file specify basic terrain instead.
|
||||
// If there's an .xml file and no .pmp, then we're probably in this XML-only mode
|
||||
only_xml = false;
|
||||
if (!FileExists(pathname) && FileExists(filename_xml))
|
||||
if (!VfsFileExists(pathname) && VfsFileExists(filename_xml))
|
||||
{
|
||||
only_xml = true;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ void CTerrainTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, co
|
||||
VfsPath pathnameXML = fs::change_extension(pathnames[i], L".xml");
|
||||
CTerrainPropertiesPtr myprops;
|
||||
// Has XML file -> attempt to load properties
|
||||
if (FileExists(pathnameXML))
|
||||
if (VfsFileExists(pathnameXML))
|
||||
{
|
||||
myprops = GetPropertiesFromFile(props, pathnameXML);
|
||||
if (myprops)
|
||||
@ -169,7 +169,7 @@ void CTerrainTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& paren
|
||||
|
||||
// Load terrains.xml first, if it exists
|
||||
VfsPath pathname = path/L"terrains.xml";
|
||||
if (FileExists(pathname))
|
||||
if (VfsFileExists(pathname))
|
||||
props = GetPropertiesFromFile(parentProps, pathname);
|
||||
|
||||
// No terrains.xml, or read failures -> use parent props (i.e.
|
||||
|
@ -615,7 +615,7 @@ void CConsole::LoadHistory()
|
||||
// just don't load anything in that case.
|
||||
|
||||
// do this before LoadFile to avoid an error message if file not found.
|
||||
if (!FileExists(m_sHistoryFile))
|
||||
if (!VfsFileExists(m_sHistoryFile))
|
||||
return;
|
||||
|
||||
shared_ptr<u8> buf; size_t buflen;
|
||||
|
@ -109,7 +109,7 @@ void CFileUnpacker::Read(const VfsPath& filename, const char magic[4])
|
||||
// since this (unfortunately) happens so often, we perform a separate
|
||||
// check and "just" raise an exception for the caller to handle.
|
||||
// (this is nicer than somehow squelching internal VFS error reporting)
|
||||
if(!FileExists(filename))
|
||||
if(!VfsFileExists(filename))
|
||||
throw PSERROR_File_OpenFailed();
|
||||
|
||||
// load the whole thing into memory
|
||||
|
@ -29,14 +29,14 @@ PIVFS g_VFS;
|
||||
|
||||
static std::vector<std::pair<FileReloadFunc, void*> > g_ReloadFuncs;
|
||||
|
||||
bool FileExists(const PIVFS& vfs, const VfsPath& pathname)
|
||||
bool VfsFileExists(const PIVFS& vfs, const VfsPath& pathname)
|
||||
{
|
||||
return vfs->GetFileInfo(pathname, 0) == INFO::OK;
|
||||
}
|
||||
|
||||
bool FileExists(const VfsPath& pathname)
|
||||
bool VfsFileExists(const VfsPath& pathname)
|
||||
{
|
||||
return FileExists(g_VFS, pathname);
|
||||
return VfsFileExists(g_VFS, pathname);
|
||||
}
|
||||
|
||||
void RegisterFileReloadFunc(FileReloadFunc func, void* obj)
|
||||
|
@ -30,9 +30,9 @@
|
||||
|
||||
extern PIVFS g_VFS;
|
||||
|
||||
extern bool FileExists(const PIVFS& vfs, const VfsPath& pathname);
|
||||
extern bool VfsFileExists(const PIVFS& vfs, const VfsPath& pathname);
|
||||
|
||||
extern bool FileExists(const VfsPath& pathname);
|
||||
extern bool VfsFileExists(const VfsPath& pathname);
|
||||
|
||||
/**
|
||||
* callback function type for file change notifications
|
||||
|
@ -741,7 +741,7 @@ bool ScriptInterface::LoadScript(const std::wstring& filename, const std::wstrin
|
||||
|
||||
bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
|
||||
{
|
||||
if (!FileExists(g_VFS, path))
|
||||
if (!VfsFileExists(g_VFS, path))
|
||||
{
|
||||
LOGERROR(L"File '%ls' does not exist", path.string().c_str());
|
||||
return false;
|
||||
@ -826,7 +826,7 @@ CScriptValRooted ScriptInterface::ParseJSON(const std::string& string_utf8)
|
||||
|
||||
CScriptValRooted ScriptInterface::ReadJSONFile(const VfsPath& path)
|
||||
{
|
||||
if (!FileExists(g_VFS, path))
|
||||
if (!VfsFileExists(g_VFS, path))
|
||||
{
|
||||
LOGERROR(L"File '%ls' does not exist", path.string().c_str());
|
||||
return CScriptValRooted();
|
||||
@ -900,7 +900,7 @@ std::wstring ScriptInterface::ToString(jsval obj, bool pretty)
|
||||
// Temporary disable the error reporter, so we don't print complaints about cyclic values
|
||||
JSErrorReporter er = JS_SetErrorReporter(m->m_cx, NULL);
|
||||
|
||||
bool ok = JS_Stringify(m->m_cx, &obj, NULL, INT_TO_JSVAL(2), &StringifierW::callback, &str);
|
||||
bool ok = JS_Stringify(m->m_cx, &obj, NULL, INT_TO_JSVAL(2), &StringifierW::callback, &str) == JS_TRUE;
|
||||
|
||||
// Restore error reporter
|
||||
JS_SetErrorReporter(m->m_cx, er);
|
||||
|
@ -167,7 +167,7 @@ LibError CSimulation2Impl::ReloadChangedFile(const VfsPath& path)
|
||||
|
||||
// If the file doesn't exist (e.g. it was deleted), don't bother loading it since that'll give an error message.
|
||||
// (Also don't bother trying to 'unload' it from the component manager, because that's not possible)
|
||||
if (!FileExists(path))
|
||||
if (!VfsFileExists(path))
|
||||
return INFO::OK;
|
||||
|
||||
LOGMESSAGE(L"Reloading simulation script '%ls'", filename.c_str());
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
void test_scripts()
|
||||
{
|
||||
if (!FileExists(L"simulation/components/tests/setup.js"))
|
||||
if (!VfsFileExists(L"simulation/components/tests/setup.js"))
|
||||
{
|
||||
debug_printf(L"WARNING: Skipping component scripts tests (can't find binaries/data/mods/public/simulation/components/tests/setup.js)\n");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user