new logger

scripts are now more error prone
This commit is contained in:
Eduardo Bart
2011-04-22 15:48:02 -03:00
parent e611734396
commit 96e0b1e909
30 changed files with 181 additions and 178 deletions

View File

@@ -44,14 +44,14 @@ bool Resources::setWriteDir(const std::string& path)
bool ret = (bool)PHYSFS_setWriteDir(path.c_str());
if(!ret)
logError("Could not set the path \"%s\" as write directory, file write will not work correctly.", path.c_str());
flogError("ERROR: Could not set the path \"%s\" as write directory, file write will not work correctly.", path.c_str());
return ret;
}
bool Resources::addToSearchPath(const std::string& path, bool insertInFront /*= true*/)
{
if(!PHYSFS_addToSearchPath(path.c_str(), insertInFront ? 0 : 1)) {
logError("Error while adding \"%s\" to resources search path: %s", path.c_str(), PHYSFS_getLastError());
flogError("ERROR: Error while adding \"%s\" to resources search path: %s", path.c_str() % PHYSFS_getLastError());
return false;
}
return true;
@@ -66,7 +66,7 @@ uchar *Resources::loadFile(const std::string& fileName, uint *fileSize)
{
PHYSFS_file *file = PHYSFS_openRead(fileName.c_str());
if(!file) {
logError("Failed to load file \"%s\": %s", fileName.c_str(), PHYSFS_getLastError());
flogError("ERROR: Failed to load file \"%s\": %s", fileName.c_str() % PHYSFS_getLastError());
*fileSize = 0;
return NULL;
}
@@ -95,7 +95,7 @@ bool Resources::saveFile(const std::string &fileName, const uchar *data, uint si
{
PHYSFS_file *file = PHYSFS_openWrite(fileName.c_str());
if(!file) {
logError("Failed to save file \"%s\": %s", fileName.c_str(), PHYSFS_getLastError());
flogError("ERROR: Failed to save file \"%s\": %s", fileName.c_str() % PHYSFS_getLastError());
return false;
}