1
0
forked from 0ad/0ad

Automatically convert most path.string().c_str() to path.string8()

Done with:

  ag -l 'LOG.*string\(\).c_str\(\)' source | xargs perl -pi -e'1 while
s/(LOG.*string)\(\)\.c_str\(\)/${1}8()/g'

This was SVN commit r16186.
This commit is contained in:
Ykkrosh 2015-01-22 20:35:17 +00:00
parent b90bc147c9
commit 38a8e2e0d6
38 changed files with 113 additions and 113 deletions

View File

@ -42,11 +42,11 @@ namespace
VfsPath* path = static_cast<VfsPath*>(cb_data);
if (severity == LOG_INFO)
LOGMESSAGE("%ls: %hs", path->string().c_str(), text);
LOGMESSAGE("%ls: %hs", path->string8(), text);
else if (severity == LOG_WARNING)
LOGWARNING("%ls: %hs", path->string().c_str(), text);
LOGWARNING("%ls: %hs", path->string8(), text);
else
LOGERROR("%ls: %hs", path->string().c_str(), text);
LOGERROR("%ls: %hs", path->string8(), text);
}
void ColladaOutput(void* cb_data, const char* data, unsigned int length)
@ -99,21 +99,21 @@ public:
if (!dll.IsLoaded() && !TryLoadDLL())
return ERR::FAIL;
LOGMESSAGE("Hotloading skeleton definitions from '%ls'", path.string().c_str());
LOGMESSAGE("Hotloading skeleton definitions from '%ls'", path.string8());
// Set the filename for the logger to report
set_logger(ColladaLog, const_cast<void*>(static_cast<const void*>(&path)));
CVFSFile skeletonFile;
if (skeletonFile.Load(m_VFS, path) != PSRETURN_OK)
{
LOGERROR("Failed to read skeleton defintions from '%ls'", path.string().c_str());
LOGERROR("Failed to read skeleton defintions from '%ls'", path.string8());
return ERR::FAIL;
}
int ok = set_skeleton_definitions((const char*)skeletonFile.GetBuffer(), (int)skeletonFile.GetBufferSize());
if (ok < 0)
{
LOGERROR("Failed to load skeleton definitions from '%ls'", path.string().c_str());
LOGERROR("Failed to load skeleton definitions from '%ls'", path.string8());
return ERR::FAIL;
}
@ -221,21 +221,21 @@ public:
bool loaded = false;
for (VfsPaths::const_iterator it = pathnames.begin(); it != pathnames.end(); ++it)
{
LOGMESSAGE("Loading skeleton definitions from '%ls'", it->string().c_str());
LOGMESSAGE("Loading skeleton definitions from '%ls'", it->string8());
// Set the filename for the logger to report
set_logger(ColladaLog, const_cast<void*>(static_cast<const void*>(&(*it))));
CVFSFile skeletonFile;
if (skeletonFile.Load(m_VFS, *it) != PSRETURN_OK)
{
LOGERROR("Failed to read skeleton defintions from '%ls'", it->string().c_str());
LOGERROR("Failed to read skeleton defintions from '%ls'", it->string8());
continue;
}
int ok = set_skeleton_definitions((const char*)skeletonFile.GetBuffer(), (int)skeletonFile.GetBufferSize());
if (ok < 0)
{
LOGERROR("Failed to load skeleton definitions from '%ls'", it->string().c_str());
LOGERROR("Failed to load skeleton definitions from '%ls'", it->string8());
continue;
}
@ -287,7 +287,7 @@ public:
// should never happen, unless there really is a problem
if (m_VFS->GetFileInfo(*it, &fileInfo) != INFO::OK)
{
LOGERROR("Failed to stat '%ls' for DAE caching", it->string().c_str());
LOGERROR("Failed to stat '%ls' for DAE caching", it->string8());
}
else
{

View File

@ -59,7 +59,7 @@ bool CFontManager::ReadFont(CFont* font, CStrIntern fontName)
const VfsPath fntName(fontName.string() + ".fnt");
if (g_VFS->LoadFile(path / fntName, buf, size) < 0)
{
LOGERROR("Failed to open font file %ls", (path / fntName).string().c_str());
LOGERROR("Failed to open font file %ls", (path / fntName).string8());
return false;
}
std::istringstream FNTStream(std::string((const char*)buf.get(), size));

View File

@ -134,10 +134,10 @@ bool CMapGeneratorWorker::Run()
}
// Load RMS
LOGMESSAGE("Loading RMS '%ls'", m_ScriptPath.string().c_str());
LOGMESSAGE("Loading RMS '%ls'", m_ScriptPath.string8());
if (!m_ScriptInterface->LoadGlobalScriptFile(m_ScriptPath))
{
LOGERROR("CMapGeneratorWorker::Run: Failed to load RMS '%ls'", m_ScriptPath.string().c_str());
LOGERROR("CMapGeneratorWorker::Run: Failed to load RMS '%ls'", m_ScriptPath.string8());
return false;
}
@ -210,7 +210,7 @@ std::vector<std::string> CMapGeneratorWorker::GetCivData(ScriptInterface::CxPriv
PSRETURN ret = file.Load(g_VFS, *it);
if (ret != PSRETURN_OK)
{
LOGERROR("CMapGeneratorWorker::GetCivData: Failed to load file '%ls': %hs", path.string().c_str(), GetErrorString(ret));
LOGERROR("CMapGeneratorWorker::GetCivData: Failed to load file '%ls': %hs", path.string8(), GetErrorString(ret));
}
else
{
@ -222,7 +222,7 @@ std::vector<std::string> CMapGeneratorWorker::GetCivData(ScriptInterface::CxPriv
{
// Some error reading directory
wchar_t error[200];
LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%ls': %ls", path.string().c_str(), StatusDescription(ret, error, ARRAY_SIZE(error)));
LOGERROR("CMapGeneratorWorker::GetCivData: Error reading directory '%ls': %ls", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
}
return data;
@ -271,11 +271,11 @@ bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)
{
for (VfsPaths::iterator it = pathnames.begin(); it != pathnames.end(); ++it)
{
LOGMESSAGE("Loading map generator script '%ls'", it->string().c_str());
LOGMESSAGE("Loading map generator script '%ls'", it->string8());
if (!m_ScriptInterface->LoadGlobalScriptFile(*it))
{
LOGERROR("CMapGeneratorWorker::LoadScripts: Failed to load script '%ls'", it->string().c_str());
LOGERROR("CMapGeneratorWorker::LoadScripts: Failed to load script '%ls'", it->string8());
return false;
}
}
@ -284,7 +284,7 @@ bool CMapGeneratorWorker::LoadScripts(const std::wstring& libraryName)
{
// Some error reading directory
wchar_t error[200];
LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%ls': %ls", path.string().c_str(), StatusDescription(ret, error, ARRAY_SIZE(error)));
LOGERROR("CMapGeneratorWorker::LoadScripts: Error reading scripts in directory '%ls': %ls", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
return false;
}

View File

@ -71,7 +71,7 @@ void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain,
}
catch (PSERROR_File_WriteFailed&)
{
LOGERROR("Failed to write map '%ls'", pathname.string().c_str());
LOGERROR("Failed to write map '%ls'", pathname.string8());
return;
}
@ -447,5 +447,5 @@ void CMapWriter::WriteXML(const VfsPath& filename,
}
}
if (!XML_StoreVFS(g_VFS, filename))
LOGERROR("Failed to write map '%ls'", filename.string().c_str());
LOGERROR("Failed to write map '%ls'", filename.string8());
}

View File

@ -53,7 +53,7 @@ CModelDefPtr CMeshManager::GetMesh(const VfsPath& pathname)
if (pmdFilename.empty())
{
LOGERROR("Could not load mesh '%ls'", pathname.string().c_str());
LOGERROR("Could not load mesh '%ls'", pathname.string8());
return CModelDefPtr();
}
@ -65,7 +65,7 @@ CModelDefPtr CMeshManager::GetMesh(const VfsPath& pathname)
}
catch (PSERROR_File&)
{
LOGERROR("Could not load mesh '%ls'", pmdFilename.string().c_str());
LOGERROR("Could not load mesh '%ls'", pmdFilename.string8());
return CModelDefPtr();
}
}

View File

@ -266,7 +266,7 @@ bool CObjectBase::Load(const VfsPath& pathname)
if (currentGroup->size() == 0)
{
LOGERROR("Actor group has zero variants ('%ls')", pathname.string().c_str());
LOGERROR("Actor group has zero variants ('%ls')", pathname.string8());
}
++currentGroup;

View File

@ -119,7 +119,7 @@ bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
CModelDefPtr modeldef (objectManager.GetMeshManager().GetMesh(m_ModelName));
if (!modeldef)
{
LOGERROR("CObjectEntry::BuildVariation(): Model %ls failed to load", m_ModelName.string().c_str());
LOGERROR("CObjectEntry::BuildVariation(): Model %ls failed to load", m_ModelName.string8());
return false;
}
@ -190,7 +190,7 @@ bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
{
// start up idling
if (!model->SetAnimation(GetRandomAnimation("idle")))
LOGERROR("Failed to set idle animation in model \"%ls\"", m_ModelName.string().c_str());
LOGERROR("Failed to set idle animation in model \"%ls\"", m_ModelName.string8());
}
// build props - TODO, RC - need to fix up bounds here
@ -240,7 +240,7 @@ bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
propmodel->ToCModel()->SetAnimation(oe->GetRandomAnimation("idle"));
}
else
LOGERROR("Failed to find matching prop point called \"%hs\" in model \"%ls\" for actor \"%ls\"", ppn.c_str(), m_ModelName.string().c_str(), m_Base->m_ShortName.c_str());
LOGERROR("Failed to find matching prop point called \"%hs\" in model \"%ls\" for actor \"%ls\"", ppn.c_str(), m_ModelName.string8(), m_Base->m_ShortName.c_str());
}
// setup flags

View File

@ -71,7 +71,7 @@ public:
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
int errLine = std::count(code.begin(), code.begin() + std::min((int)code.length(), errPos + 1), '\n') + 1;
char* errStr = (char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB);
LOGERROR("Failed to compile %hs program '%ls' (line %d):\n%hs", targetName, file.string().c_str(), errLine, errStr);
LOGERROR("Failed to compile %hs program '%ls' (line %d):\n%hs", targetName, file.string8(), errLine, errStr);
return false;
}
@ -310,9 +310,9 @@ public:
pglGetShaderInfoLog(shader, length, NULL, infolog);
if (ok)
LOGMESSAGE("Info when compiling shader '%ls':\n%hs", file.string().c_str(), infolog);
LOGMESSAGE("Info when compiling shader '%ls':\n%hs", file.string8(), infolog);
else
LOGERROR("Failed to compile shader '%ls':\n%hs", file.string().c_str(), infolog);
LOGERROR("Failed to compile shader '%ls':\n%hs", file.string8(), infolog);
delete[] infolog;
}
@ -357,9 +357,9 @@ public:
pglGetProgramInfoLog(m_Program, length, NULL, infolog);
if (ok)
LOGMESSAGE("Info when linking program '%ls'+'%ls':\n%hs", m_VertexFile.string().c_str(), m_FragmentFile.string().c_str(), infolog);
LOGMESSAGE("Info when linking program '%ls'+'%ls':\n%hs", m_VertexFile.string8(), m_FragmentFile.string8(), infolog);
else
LOGERROR("Failed to link program '%ls'+'%ls':\n%hs", m_VertexFile.string().c_str(), m_FragmentFile.string().c_str(), infolog);
LOGERROR("Failed to link program '%ls'+'%ls':\n%hs", m_VertexFile.string8(), m_FragmentFile.string8(), infolog);
delete[] infolog;
}

View File

@ -65,7 +65,7 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const VfsPath& pathname)
if (psaFilename.empty())
{
LOGERROR("Could not load animation '%ls'", pathname.string().c_str());
LOGERROR("Could not load animation '%ls'", pathname.string8());
def = NULL;
}
else
@ -76,14 +76,14 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const VfsPath& pathname)
}
catch (PSERROR_File&)
{
LOGERROR("Could not load animation '%ls'", psaFilename.string().c_str());
LOGERROR("Could not load animation '%ls'", psaFilename.string8());
}
}
if (def)
LOGMESSAGE("CSkeletonAnimManager::GetAnimation(%ls): Loaded successfully", pathname.string().c_str());
LOGMESSAGE("CSkeletonAnimManager::GetAnimation(%ls): Loaded successfully", pathname.string8());
else
LOGERROR("CSkeletonAnimManager::GetAnimation(%ls): Failed loading, marked file as bad", pathname.string().c_str());
LOGERROR("CSkeletonAnimManager::GetAnimation(%ls): Failed loading, marked file as bad", pathname.string8());
// Add to map
m_Animations[name] = def; // NULL if failed to load - we won't try loading it again

View File

@ -47,7 +47,7 @@ CTerrainTextureEntry::CTerrainTextureEntry(CTerrainPropertiesPtr properties, con
CXeromyces XeroFile;
if (XeroFile.Load(g_VFS, path) != PSRETURN_OK)
{
LOGERROR("Terrain xml not found (%hs)", path.string().c_str());
LOGERROR("Terrain xml not found (%hs)", path.string8());
return;
}

View File

@ -141,7 +141,7 @@ void CTerrainTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, co
void CTerrainTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& parentProps, const VfsPath& path)
{
//LOGMESSAGE("CTextureManager::RecurseDirectory(%ls)", path.string().c_str());
//LOGMESSAGE("CTextureManager::RecurseDirectory(%ls)", path.string8());
CTerrainPropertiesPtr props;
@ -153,7 +153,7 @@ void CTerrainTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& paren
// No terrains.xml, or read failures -> use parent props (i.e.
if (!props)
{
LOGMESSAGE("CTerrainTextureManager::RecurseDirectory(%ls): no terrains.xml (or errors while loading) - using parent properties", path.string().c_str());
LOGMESSAGE("CTerrainTextureManager::RecurseDirectory(%ls): no terrains.xml (or errors while loading) - using parent properties", path.string8());
props = parentProps;
}

View File

@ -120,7 +120,7 @@ CTextureConverter::SettingsFile* CTextureConverter::LoadSettings(const VfsPath&
if (root.GetNodeName() != el_textures)
{
LOGERROR("Invalid texture settings file \"%ls\" (unrecognised root element)", path.string().c_str());
LOGERROR("Invalid texture settings file \"%ls\" (unrecognised root element)", path.string8());
return NULL;
}
@ -326,14 +326,14 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
size_t fileSize;
if (m_VFS->LoadFile(src, file, fileSize) < 0)
{
LOGERROR("Failed to load texture \"%ls\"", src.string().c_str());
LOGERROR("Failed to load texture \"%ls\"", src.string8());
return false;
}
Tex tex;
if (tex.decode(file, fileSize) < 0)
{
LOGERROR("Failed to decode texture \"%ls\"", src.string().c_str());
LOGERROR("Failed to decode texture \"%ls\"", src.string8());
return false;
}
@ -345,7 +345,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
// Convert to uncompressed 8-bit with no mipmaps
if (tex.transform_to((tex.m_Flags | TEX_GREY) & ~(TEX_DXT | TEX_MIPMAPS | TEX_ALPHA)) < 0)
{
LOGERROR("Failed to transform texture \"%ls\"", src.string().c_str());
LOGERROR("Failed to transform texture \"%ls\"", src.string8());
return false;
}
}
@ -356,14 +356,14 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
// (plain_transform doesn't know how to construct the alpha channel)
if (tex.m_Flags & TEX_GREY)
{
LOGERROR("Failed to convert grayscale texture \"%ls\" - only RGB textures are currently supported", src.string().c_str());
LOGERROR("Failed to convert grayscale texture \"%ls\" - only RGB textures are currently supported", src.string8());
return false;
}
// Convert to uncompressed BGRA with no mipmaps
if (tex.transform_to((tex.m_Flags | TEX_BGR | TEX_ALPHA) & ~(TEX_DXT | TEX_MIPMAPS)) < 0)
{
LOGERROR("Failed to transform texture \"%ls\"", src.string().c_str());
LOGERROR("Failed to transform texture \"%ls\"", src.string8());
return false;
}
}
@ -482,7 +482,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
return true;
#else
LOGERROR("Failed to convert texture \"%ls\" (NVTT not available)", src.string().c_str());
LOGERROR("Failed to convert texture \"%ls\" (NVTT not available)", src.string8());
return false;
#endif
}

View File

@ -178,7 +178,7 @@ public:
Handle h = ogl_tex_load(m_VFS, path, RES_UNIQUE);
if (h <= 0)
{
LOGERROR("Texture failed to load; \"%ls\"", texture->m_Properties.m_Path.string().c_str());
LOGERROR("Texture failed to load; \"%ls\"", texture->m_Properties.m_Path.string8());
// Replace with error texture to make it obvious
texture->SetHandle(m_ErrorHandle);
@ -218,7 +218,7 @@ public:
// Upload to GL
if (!m_DisableGL && ogl_tex_upload(h, texture->m_Properties.m_Format) < 0)
{
LOGERROR("Texture failed to upload: \"%ls\"", texture->m_Properties.m_Path.string().c_str());
LOGERROR("Texture failed to upload: \"%ls\"", texture->m_Properties.m_Path.string8());
ogl_tex_free(h);
@ -277,7 +277,7 @@ public:
// No source file or archive cache was found, so we can't load the
// real texture at all - return the error texture instead
LOGERROR("CCacheLoader failed to find archived or source file for: \"%ls\"", texture->m_Properties.m_Path.string().c_str());
LOGERROR("CCacheLoader failed to find archived or source file for: \"%ls\"", texture->m_Properties.m_Path.string8());
texture->SetHandle(m_ErrorHandle);
return true;
}
@ -345,7 +345,7 @@ public:
}
else
{
LOGERROR("Texture failed to convert: \"%ls\"", texture->m_Properties.m_Path.string().c_str());
LOGERROR("Texture failed to convert: \"%ls\"", texture->m_Properties.m_Path.string8());
texture->SetHandle(m_ErrorHandle);
}
texture->m_State = CTexture::LOADED;

View File

@ -969,7 +969,7 @@ void CGUI::LoadXmlFile(const VfsPath& Filename, boost::unordered_set<VfsPath>& P
}
catch (PSERROR_GUI& e)
{
LOGERROR("Errors loading GUI file %ls (%u)", Filename.string().c_str(), e.getCode());
LOGERROR("Errors loading GUI file %ls (%u)", Filename.string8(), e.getCode());
return;
}
}
@ -1379,14 +1379,14 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
CXeromyces XeroIncluded;
if (XeroIncluded.Load(g_VFS, *it) != PSRETURN_OK)
{
LOGERROR("GUI: Error reading included XML: '%ls'", (*it).string().c_str());
LOGERROR("GUI: Error reading included XML: '%ls'", (*it).string8());
continue;
}
XMBElement node = XeroIncluded.GetRoot();
if (node.GetNodeName() != XeroIncluded.GetElementID("object"))
{
LOGERROR("GUI: Error reading included XML: '%ls', root element must have be of type 'object'.", (*it).string().c_str());
LOGERROR("GUI: Error reading included XML: '%ls', root element must have be of type 'object'.", (*it).string8());
continue;
}
Xeromyces_ReadObject(node, &XeroIncluded, object, NameSubst, Paths, nesting_depth+1);
@ -1512,7 +1512,7 @@ void CGUI::Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile, boost::un
}
catch (PSERROR_Scripting& e)
{
LOGERROR("GUI: Error executing script %ls: %hs", (*it).string().c_str(), e.what());
LOGERROR("GUI: Error executing script %ls: %hs", (*it).string8(), e.what());
}
}
}

View File

@ -264,7 +264,7 @@ Status CGUIManager::ReloadChangedFile(const VfsPath& path)
{
if (it->inputs.count(path))
{
LOGMESSAGE("GUI file '%ls' changed - reloading page '%ls'", path.string().c_str(), it->name.c_str());
LOGMESSAGE("GUI file '%ls' changed - reloading page '%ls'", path.string8(), it->name.c_str());
LoadPage(*it);
// TODO: this can crash if LoadPage runs an init script which modifies the page stack and breaks our iterators
}

View File

@ -676,7 +676,7 @@ void DumpTerrainMipmap(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
g_Game->GetWorld()->GetTerrain()->GetHeightMipmap().DumpToDisk(filename);
OsPath realPath;
g_VFS->GetRealPath(filename, realPath);
LOGMESSAGERENDER("Terrain mipmap written to '%ls'", realPath.string().c_str());
LOGMESSAGERENDER("Terrain mipmap written to '%ls'", realPath.string8());
}
void EnableTimeWarpRecording(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), unsigned int numTurns)

View File

@ -470,12 +470,12 @@ Status L10n::ReloadChangedFile(const VfsPath& path)
if (path.string().rfind(dictName) == std::string::npos)
return INFO::OK;
LOGMESSAGE("Hotloading translations from '%ls'", path.string().c_str());
LOGMESSAGE("Hotloading translations from '%ls'", path.string8());
CVFSFile file;
if (file.Load(g_VFS, path) != PSRETURN_OK)
{
LOGERROR("Failed to read translations from '%ls'", path.string().c_str());
LOGERROR("Failed to read translations from '%ls'", path.string8());
return ERR::FAIL;
}

View File

@ -214,15 +214,15 @@ bool CConfigDB::Reload(EConfigNamespace ns)
// Handle missing files quietly
if (g_VFS->GetFileInfo(m_ConfigFile[ns], NULL) < 0)
{
LOGMESSAGE("Cannot find config file \"%ls\" - ignoring", m_ConfigFile[ns].string().c_str());
LOGMESSAGE("Cannot find config file \"%ls\" - ignoring", m_ConfigFile[ns].string8());
return false;
}
LOGMESSAGE("Loading config file \"%ls\"", m_ConfigFile[ns].string().c_str());
LOGMESSAGE("Loading config file \"%ls\"", m_ConfigFile[ns].string8());
Status ret = g_VFS->LoadFile(m_ConfigFile[ns], buffer, buflen);
if (ret != INFO::OK)
{
LOGERROR("CConfigDB::Reload(): vfs_load for \"%ls\" failed: return was %lld", m_ConfigFile[ns].string().c_str(), (long long)ret);
LOGERROR("CConfigDB::Reload(): vfs_load for \"%ls\" failed: return was %lld", m_ConfigFile[ns].string8(), (long long)ret);
return false;
}
}
@ -256,7 +256,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
if (pos == filebufend || *pos == '\n')
{
LOGERROR("Config header with missing close tag encountered on line %d in '%ls'", line, m_ConfigFile[ns].string().c_str());
LOGERROR("Config header with missing close tag encountered on line %d in '%ls'", line, m_ConfigFile[ns].string8());
header.clear();
++line;
continue;
@ -267,7 +267,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
while (++pos < filebufend && *pos != '\n' && *pos != ';')
if (*pos != ' ' && *pos != '\r')
{
LOGERROR("Config settings on the same line as a header on line %d in '%ls'", line, m_ConfigFile[ns].string().c_str());
LOGERROR("Config settings on the same line as a header on line %d in '%ls'", line, m_ConfigFile[ns].string8());
break;
}
while (pos < filebufend && *pos != '\n')
@ -288,7 +288,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
{
if (*pos == '\\' && ++pos == filebufend)
{
LOGERROR("Escape character at end of input (line %d in '%ls')", line, m_ConfigFile[ns].string().c_str());
LOGERROR("Escape character at end of input (line %d in '%ls')", line, m_ConfigFile[ns].string8());
break;
}
@ -316,7 +316,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
}
}
if (quoted) // We ignore the invalid parameter
LOGERROR("Unmatched quote while parsing config file '%ls' on line %d", m_ConfigFile[ns].string().c_str(), line);
LOGERROR("Unmatched quote while parsing config file '%ls' on line %d", m_ConfigFile[ns].string8(), line);
else if (!value.empty())
values.push_back(value);
value.clear();
@ -348,7 +348,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
}
}
else if (!name.empty())
LOGERROR("Encountered config setting '%hs' without value while parsing '%ls' on line %d", name.c_str(), m_ConfigFile[ns].string().c_str(), line);
LOGERROR("Encountered config setting '%hs' without value while parsing '%ls' on line %d", name.c_str(), m_ConfigFile[ns].string8(), line);
name.clear();
values.clear();
@ -393,7 +393,7 @@ bool CConfigDB::WriteFile(EConfigNamespace ns, const VfsPath& path)
Status ret = g_VFS->CreateFile(path, buf, len);
if (ret < 0)
{
LOGERROR("CConfigDB::WriteFile(): CreateFile \"%ls\" failed (error: %d)", path.string().c_str(), (int)ret);
LOGERROR("CConfigDB::WriteFile(): CreateFile \"%ls\" failed (error: %d)", path.string8(), (int)ret);
return false;
}

View File

@ -69,7 +69,7 @@ void CFilePacker::Write(const VfsPath& filename)
const Status st = g_VFS->CreateFile(filename, m_writeBuffer.Data(), m_writeBuffer.Size());
if (st < 0)
{
LOGERROR("Failed to write file '%ls' with status '%lld'", filename.string().c_str(), (long long)st);
LOGERROR("Failed to write file '%ls' with status '%lld'", filename.string8(), (long long)st);
throw PSERROR_File_WriteFailed();
}
}

View File

@ -124,7 +124,7 @@ PSRETURN CVFSFile::Load(const PIVFS& vfs, const VfsPath& filename, bool log /* =
if (ret != INFO::OK)
{
if (log)
LOGERROR("CVFSFile: file %ls couldn't be opened (vfs_load: %lld)", filename.string().c_str(), (long long)ret);
LOGERROR("CVFSFile: file %ls couldn't be opened (vfs_load: %lld)", filename.string8(), (long long)ret);
m_Buffer.reset();
m_BufferSize = 0;
return PSRETURN_CVFSFile_LoadFailed;

View File

@ -1132,7 +1132,7 @@ CStr8 LoadSettingsOfScenarioMap(const VfsPath &mapPath)
if (INFO::OK != loadResult)
{
LOGERROR("LoadSettingsOfScenarioMap: Unable to load map file '%ls'", mapPath.string().c_str());
LOGERROR("LoadSettingsOfScenarioMap: Unable to load map file '%ls'", mapPath.string8());
throw PSERROR_Game_World_MapLoadFailed("Unable to load map file, check the path for typos.");
}
XMBElement mapElement = mapFile.GetRoot();

View File

@ -172,7 +172,7 @@ Paths::Paths(const CmdLineArgs& args)
// make sure it's valid
if(!FileExists(pathname))
{
LOGERROR("Cannot find executable (expected at '%ls')", pathname.string().c_str());
LOGERROR("Cannot find executable (expected at '%ls')", pathname.string8());
WARN_IF_ERR(StatusFromErrno());
}

View File

@ -575,7 +575,7 @@ void CProfileViewer::SaveToFile()
}
else
{
LOGMESSAGERENDER("Profiler snapshot saved to '%ls'", path.string().c_str());
LOGMESSAGERENDER("Profiler snapshot saved to '%ls'", path.string8());
}
}

View File

@ -126,7 +126,7 @@ Status SavedGames::Save(const std::wstring& name, const std::wstring& descriptio
OsPath realPath;
WARN_RETURN_STATUS_IF_ERR(g_VFS->GetRealPath(filename, realPath));
LOGMESSAGERENDER(g_L10n.Translate("Saved game to '%ls'"), realPath.string().c_str());
LOGMESSAGERENDER(g_L10n.Translate("Saved game to '%ls'"), realPath.string8());
return INFO::OK;
}
@ -244,7 +244,7 @@ std::vector<CScriptValRooted> SavedGames::GetSavedGames(ScriptInterface& scriptI
if (!archiveReader)
{
// Triggered by e.g. the file being open in another program
LOGWARNING("Failed to read saved game '%ls'", realPath.string().c_str());
LOGWARNING("Failed to read saved game '%ls'", realPath.string8());
continue; // skip this file
}

View File

@ -241,10 +241,10 @@ void WriteScreenshot(const VfsPath& extension)
{
OsPath realPath;
g_VFS->GetRealPath(filename, realPath);
LOGMESSAGERENDER(g_L10n.Translate("Screenshot written to '%ls'"), realPath.string().c_str());
LOGMESSAGERENDER(g_L10n.Translate("Screenshot written to '%ls'"), realPath.string8());
}
else
LOGERROR("Error writing screenshot to '%ls'", filename.string().c_str());
LOGERROR("Error writing screenshot to '%ls'", filename.string8());
}
@ -374,10 +374,10 @@ void WriteBigScreenshot(const VfsPath& extension, int tiles)
{
OsPath realPath;
g_VFS->GetRealPath(filename, realPath);
LOGMESSAGERENDER(g_L10n.Translate("Screenshot written to '%ls'"), realPath.string().c_str());
LOGMESSAGERENDER(g_L10n.Translate("Screenshot written to '%ls'"), realPath.string8());
}
else
LOGERROR("Error writing screenshot to '%ls'", filename.string().c_str());
LOGERROR("Error writing screenshot to '%ls'", filename.string8());
free(tile_data);
}

View File

@ -89,7 +89,7 @@ void CWorld::RegisterInit(const CStrW& mapFile, const CScriptValRooted& settings
catch (PSERROR_File& err)
{
delete reader;
LOGERROR("Failed to load map %ls: %hs", mapfilename.string().c_str(), err.what());
LOGERROR("Failed to load map %ls: %hs", mapfilename.string8(), err.what());
throw PSERROR_Game_World_MapLoadFailed("Failed to load map.\nCheck application log for details.");
}
}

View File

@ -102,7 +102,7 @@ bool XMLWriter_File::StoreVFS(const PIVFS& vfs, const VfsPath& pathname)
Status ret = vfs->CreateFile(pathname, data, size);
if (ret < 0)
{
LOGERROR("Error saving XML data through VFS: %lld '%ls'", (long long)ret, pathname.string().c_str());
LOGERROR("Error saving XML data through VFS: %lld '%ls'", (long long)ret, pathname.string8());
return false;
}
return true;

View File

@ -89,7 +89,7 @@ PSRETURN CXeromyces::Load(const PIVFS& vfs, const VfsPath& filename)
// No source file or archive cache was found, so we can't load the
// XML file at all
LOGERROR("CCacheLoader failed to find archived or source file for: \"%ls\"", filename.string().c_str());
LOGERROR("CCacheLoader failed to find archived or source file for: \"%ls\"", filename.string8());
return PSRETURN_Xeromyces_XMLOpenFailed;
}
@ -111,7 +111,7 @@ PSRETURN CXeromyces::ConvertFile(const PIVFS& vfs, const VfsPath& filename, cons
CVFSFile input;
if (input.Load(vfs, filename))
{
LOGERROR("CXeromyces: Failed to open XML file %ls", filename.string().c_str());
LOGERROR("CXeromyces: Failed to open XML file %ls", filename.string8());
return PSRETURN_Xeromyces_XMLOpenFailed;
}
@ -120,7 +120,7 @@ PSRETURN CXeromyces::ConvertFile(const PIVFS& vfs, const VfsPath& filename, cons
filename8.c_str(), NULL, XML_PARSE_NONET|XML_PARSE_NOCDATA);
if (! doc)
{
LOGERROR("CXeromyces: Failed to parse XML file %ls", filename.string().c_str());
LOGERROR("CXeromyces: Failed to parse XML file %ls", filename.string8());
return PSRETURN_Xeromyces_XMLParseError;
}

View File

@ -98,7 +98,7 @@ void ModelRenderer::BuildPositionAndNormals(
// some broken situations
if (numVertices && vertices[0].m_Blend.m_Bone[0] == 0xff)
{
LOGERROR("Model %ls is boned with unboned animation", mdef->GetName().string().c_str());
LOGERROR("Model %ls is boned with unboned animation", mdef->GetName().string8());
return;
}

View File

@ -519,7 +519,7 @@ std::vector<CStrW> CPostprocManager::GetPostEffects()
VfsPaths pathnames;
if(vfs::GetPathnames(g_VFS, path, 0, pathnames) < 0)
LOGERROR("Error finding Post effects in '%ls'", path.string().c_str());
LOGERROR("Error finding Post effects in '%ls'", path.string8());
for(size_t i = 0; i < pathnames.size(); i++)
{

View File

@ -207,7 +207,7 @@ std::vector<CStrW> SkyManager::GetSkySets() const
DirectoryNames subdirectories;
if(g_VFS->GetDirectoryEntries(path, 0, &subdirectories) < 0)
{
LOGERROR("Error opening directory '%ls'", path.string().c_str());
LOGERROR("Error opening directory '%ls'", path.string8());
return std::vector<CStrW>(1, GetSkySet()); // just return what we currently have
}

View File

@ -478,7 +478,7 @@ bool ScriptInterface::LoadGlobalScripts()
{
if (!LoadGlobalScriptFile(*it))
{
LOGERROR("LoadGlobalScripts: Failed to load script %ls", it->string().c_str());
LOGERROR("LoadGlobalScripts: Failed to load script %ls", it->string8());
return false;
}
}
@ -866,7 +866,7 @@ bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
JSAutoRequest rq(m->m_cx);
if (!VfsFileExists(path))
{
LOGERROR("File '%ls' does not exist", path.string().c_str());
LOGERROR("File '%ls' does not exist", path.string8());
return false;
}
@ -876,7 +876,7 @@ bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
if (ret != PSRETURN_OK)
{
LOGERROR("Failed to load file '%ls': %hs", path.string().c_str(), GetErrorString(ret));
LOGERROR("Failed to load file '%ls': %hs", path.string8(), GetErrorString(ret));
return false;
}
@ -954,7 +954,7 @@ void ScriptInterface::ReadJSONFile(const VfsPath& path, JS::MutableHandleValue o
{
if (!VfsFileExists(path))
{
LOGERROR("File '%ls' does not exist", path.string().c_str());
LOGERROR("File '%ls' does not exist", path.string8());
return;
}
@ -964,14 +964,14 @@ void ScriptInterface::ReadJSONFile(const VfsPath& path, JS::MutableHandleValue o
if (ret != PSRETURN_OK)
{
LOGERROR("Failed to load file '%ls': %hs", path.string().c_str(), GetErrorString(ret));
LOGERROR("Failed to load file '%ls': %hs", path.string8(), GetErrorString(ret));
return;
}
std::string content(file.DecodeUTF8()); // assume it's UTF-8
if (!ParseJSON(content, out))
LOGERROR("Failed to parse '%ls'", path.string().c_str());
LOGERROR("Failed to parse '%ls'", path.string8());
}
struct Stringifier

View File

@ -187,7 +187,7 @@ bool CSimulation2Impl::LoadScripts(CComponentManager& componentManager, std::set
VfsPath filename = *it;
if (loadedScripts)
loadedScripts->insert(filename);
LOGMESSAGE("Loading simulation script '%ls'", filename.string().c_str());
LOGMESSAGE("Loading simulation script '%ls'", filename.string8());
if (!componentManager.LoadScript(filename))
ok = false;
}
@ -224,7 +224,7 @@ Status CSimulation2Impl::ReloadChangedFile(const VfsPath& path)
if (!VfsFileExists(path))
return INFO::OK;
LOGMESSAGE("Reloading simulation script '%ls'", path.string().c_str());
LOGMESSAGE("Reloading simulation script '%ls'", path.string8());
if (!m_ComponentManager.LoadScript(path, true))
return ERR::FAIL;
@ -828,7 +828,7 @@ static std::vector<std::string> GetJSONData(const VfsPath& path)
{
// Some error reading directory
wchar_t error[200];
LOGERROR("Error reading directory '%ls': %ls", path.string().c_str(), StatusDescription(ret, error, ARRAY_SIZE(error)));
LOGERROR("Error reading directory '%ls': %ls", path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
return std::vector<std::string>();
}
@ -840,7 +840,7 @@ static std::vector<std::string> GetJSONData(const VfsPath& path)
PSRETURN ret = file.Load(g_VFS, *it);
if (ret != PSRETURN_OK)
{
LOGERROR("GetJSONData: Failed to load file '%ls': %hs", path.string().c_str(), GetErrorString(ret));
LOGERROR("GetJSONData: Failed to load file '%ls': %hs", path.string8(), GetErrorString(ret));
continue;
}
@ -864,7 +864,7 @@ static std::string ReadJSON(const VfsPath& path)
{
if (!VfsFileExists(path))
{
LOGERROR("File '%ls' does not exist", path.string().c_str());
LOGERROR("File '%ls' does not exist", path.string8());
return std::string();
}
@ -873,7 +873,7 @@ static std::string ReadJSON(const VfsPath& path)
PSRETURN ret = file.Load(g_VFS, path);
if (ret != PSRETURN_OK)
{
LOGERROR("Failed to load file '%ls': %hs", path.string().c_str(), GetErrorString(ret));
LOGERROR("Failed to load file '%ls': %hs", path.string8(), GetErrorString(ret));
return std::string();
}

View File

@ -104,7 +104,7 @@ private:
m_Worker.LoadMetadata(path, &metadata);
if (metadata.isUndefined())
{
LOGERROR("Failed to create AI player: can't find %ls", path.string().c_str());
LOGERROR("Failed to create AI player: can't find %ls", path.string8());
return false;
}
@ -116,7 +116,7 @@ private:
JS::RootedValue ctor(cx);
if (!m_ScriptInterface->HasProperty(metadata, "moduleName"))
{
LOGERROR("Failed to create AI player: %ls: missing 'moduleName'", path.string().c_str());
LOGERROR("Failed to create AI player: %ls: missing 'moduleName'", path.string8());
return false;
}
@ -124,13 +124,13 @@ private:
if (!m_ScriptInterface->GetProperty(global, moduleName.c_str(), &objectWithConstructor)
|| objectWithConstructor.isUndefined())
{
LOGERROR("Failed to create AI player: %ls: can't find the module that should contain the constructor: '%hs'", path.string().c_str(), moduleName.c_str());
LOGERROR("Failed to create AI player: %ls: can't find the module that should contain the constructor: '%hs'", path.string8(), moduleName.c_str());
return false;
}
if (!m_ScriptInterface->GetProperty(metadata, "constructor", constructor))
{
LOGERROR("Failed to create AI player: %ls: missing 'constructor'", path.string().c_str());
LOGERROR("Failed to create AI player: %ls: missing 'constructor'", path.string8());
return false;
}
@ -138,7 +138,7 @@ private:
if (!m_ScriptInterface->GetProperty(objectWithConstructor, constructor.c_str(), &ctor)
|| ctor.isNull())
{
LOGERROR("Failed to create AI player: %ls: can't find constructor '%hs'", path.string().c_str(), constructor.c_str());
LOGERROR("Failed to create AI player: %ls: can't find constructor '%hs'", path.string8(), constructor.c_str());
return false;
}
@ -160,7 +160,7 @@ private:
if (obj.isNull())
{
LOGERROR("Failed to create AI player: %ls: error calling constructor '%hs'", path.string().c_str(), constructor.c_str());
LOGERROR("Failed to create AI player: %ls: error calling constructor '%hs'", path.string8(), constructor.c_str());
return false;
}
@ -269,7 +269,7 @@ public:
{
if (!m_ScriptInterface->LoadGlobalScriptFile(*it))
{
LOGERROR("Failed to load script %ls", it->string().c_str());
LOGERROR("Failed to load script %ls", it->string8());
return false;
}
}
@ -391,14 +391,14 @@ public:
JS::RootedValue ctor(cx);
if (!m_ScriptInterface->GetProperty(global, "API3", &AIModule) || AIModule.isUndefined())
{
LOGERROR("Failed to create shared AI component: %ls: can't find module '%hs'", path.string().c_str(), "API3");
LOGERROR("Failed to create shared AI component: %ls: can't find module '%hs'", path.string8(), "API3");
return false;
}
if (!m_ScriptInterface->GetProperty(AIModule, "SharedScript", &ctor)
|| ctor.isUndefined())
{
LOGERROR("Failed to create shared AI component: %ls: can't find constructor '%hs'", path.string().c_str(), "SharedScript");
LOGERROR("Failed to create shared AI component: %ls: can't find constructor '%hs'", path.string8(), "SharedScript");
return false;
}
@ -440,7 +440,7 @@ public:
if (tmpSharedAIObj.isNull())
{
LOGERROR("Failed to create shared AI component: %ls: error calling constructor '%hs'", path.string().c_str(), "SharedScript");
LOGERROR("Failed to create shared AI component: %ls: error calling constructor '%hs'", path.string8(), "SharedScript");
return false;
}

View File

@ -1226,7 +1226,7 @@ std::vector<std::string> CComponentManager::Script_FindJSONFiles(ScriptInterface
{
// Some error reading directory
wchar_t error[200];
LOGERROR("Error reading directory '%ls': %ls", cbData.path.string().c_str(), StatusDescription(ret, error, ARRAY_SIZE(error)));
LOGERROR("Error reading directory '%ls': %ls", cbData.path.string8(), StatusDescription(ret, error, ARRAY_SIZE(error)));
}
return cbData.templates;

View File

@ -216,7 +216,7 @@ void CSoundManager::al_check(const char* caller, int line)
Status CSoundManager::ReloadChangedFiles(const VfsPath& UNUSED(path))
{
// LOGERROR("GUI file '%ls' changed - reloading page", path.string().c_str());
// LOGERROR("GUI file '%ls' changed - reloading page", path.string8());
return INFO::OK;
}
@ -654,7 +654,7 @@ void CSoundManager::PlayAsGroup(const VfsPath& groupPath, CVector3D sourcePos, e
group = new CSoundGroup();
if (!group->LoadSoundGroup(L"audio/" + groupPath.string()))
{
LOGERROR("Failed to load sound group '%ls'", groupPath.string().c_str());
LOGERROR("Failed to load sound group '%ls'", groupPath.string8());
delete group;
group = NULL;
}

View File

@ -107,7 +107,7 @@ CSoundData* CSoundData::SoundDataFromOgg(const VfsPath& itemPath)
}
else
{
LOGERROR("could not initialize ogg data at %ls", itemPath.string().c_str());
LOGERROR("could not initialize ogg data at %ls", itemPath.string8());
delete oggAnswer;
}

View File

@ -197,7 +197,7 @@ void CSoundGroup::UploadPropertiesAndPlay(size_t theIndex, const CVector3D& posi
itemRollOff = 0;
if ( sndData->IsStereo() )
LOGWARNING( "OpenAL: stereo sounds can't be positioned: %ls", sndData->GetFileName()->string().c_str() );
LOGWARNING( "OpenAL: stereo sounds can't be positioned: %ls", sndData->GetFileName()->string8() );
hSound->SetLocation(CVector3D((sndDist * sin(offSet)), 0, - sndDist * cos(offSet)));
hSound->SetRollOff(itemRollOff);
@ -227,7 +227,7 @@ static void HandleError(const CStrW& message, const VfsPath& pathname, Status er
{
if (err == ERR::AGAIN)
return; // open failed because sound is disabled (don't log this)
LOGERROR("%ls: pathname=%ls, error=%ls", message.c_str(), pathname.string().c_str(), ErrorString(err));
LOGERROR("%ls: pathname=%ls, error=%ls", message.c_str(), pathname.string8(), ErrorString(err));
}
void CSoundGroup::PlayNext(const CVector3D& position, entity_id_t source)