1
0
forked from mirrors/0ad

Actually state the file instead of the directory in some error messages.

This was SVN commit r16802.
This commit is contained in:
leper
2015-06-21 18:46:33 +00:00
parent 5a0b9b0e70
commit ae4dfe294d
2 changed files with 11 additions and 17 deletions
+8 -14
View File
@@ -63,7 +63,7 @@ void* CMapGeneratorWorker::RunThread(void *data)
self->m_ScriptInterface = new ScriptInterface("RMS", "MapGenerator", ScriptInterface::CreateRuntime(g_ScriptRuntime, RMS_RUNTIME_SIZE));
// Run map generation scripts
if ((!self->Run()) || (self->m_Progress > 0))
if (!self->Run() || self->m_Progress > 0)
{
// Don't leave progress in an unknown state, if generator failed, set it to -1
CScopeLock lock(self->m_WorkerMutex);
@@ -198,19 +198,15 @@ std::vector<std::string> CMapGeneratorWorker::GetCivData(ScriptInterface::CxPriv
Status ret = vfs::GetPathnames(g_VFS, path, L"*.json", pathnames);
if (ret == INFO::OK)
{
for (VfsPaths::iterator it = pathnames.begin(); it != pathnames.end(); ++it)
for (const VfsPath& p : pathnames)
{
// Load JSON file
CVFSFile file;
PSRETURN ret = file.Load(g_VFS, *it);
PSRETURN ret = file.Load(g_VFS, p);
if (ret != PSRETURN_OK)
{
LOGERROR("CMapGeneratorWorker::GetCivData: Failed to load file '%s': %s", path.string8(), GetErrorString(ret));
}
LOGERROR("CMapGeneratorWorker::GetCivData: Failed to load file '%s': %s", p.string8(), GetErrorString(ret));
else
{
data.push_back(file.DecodeUTF8()); // assume it's UTF-8
}
}
}
else
@@ -250,9 +246,7 @@ bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)
{
// Ignore libraries that are already loaded
if (m_LoadedLibraries.find(libraryName) != m_LoadedLibraries.end())
{
return true;
}
// Mark this as loaded, to prevent it recursively loading itself
m_LoadedLibraries.insert(libraryName);
@@ -264,13 +258,13 @@ bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)
Status ret = vfs::GetPathnames(g_VFS, path, L"*.js", pathnames);
if (ret == INFO::OK)
{
for (VfsPaths::iterator it = pathnames.begin(); it != pathnames.end(); ++it)
for (const VfsPath& p : pathnames)
{
LOGMESSAGE("Loading map generator script '%s'", it->string8());
LOGMESSAGE("Loading map generator script '%s'", p.string8());
if (!m_ScriptInterface->LoadGlobalScriptFile(*it))
if (!m_ScriptInterface->LoadGlobalScriptFile(p))
{
LOGERROR("CMapGeneratorWorker::LoadScripts: Failed to load script '%s'", it->string8());
LOGERROR("CMapGeneratorWorker::LoadScripts: Failed to load script '%s'", p.string8());
return false;
}
}
+3 -3
View File
@@ -832,14 +832,14 @@ static std::vector<std::string> GetJSONData(const VfsPath& path)
}
std::vector<std::string> data;
for (VfsPaths::const_iterator it = pathnames.begin(); it != pathnames.end(); ++it)
for (const VfsPath& p : pathnames)
{
// Load JSON file
CVFSFile file;
PSRETURN ret = file.Load(g_VFS, *it);
PSRETURN ret = file.Load(g_VFS, p);
if (ret != PSRETURN_OK)
{
LOGERROR("GetJSONData: Failed to load file '%s': %s", path.string8(), GetErrorString(ret));
LOGERROR("GetJSONData: Failed to load file '%s': %s", p.string8(), GetErrorString(ret));
continue;
}