Modify debug output to specify the 'real' directory that physfs is using for the file in question.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5958 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2008-09-07 20:00:54 +00:00
parent 64715c592f
commit 21fdab0117
16 changed files with 26 additions and 14 deletions

View File

@ -179,7 +179,7 @@ static BOOL registry_load( const char *filename )
int l; // sscanf expects an int to receive %n, not an unsigned int
UDWORD filesize;
debug(LOG_WZ, "Loading the registry from %s", filename);
debug(LOG_WZ, "Loading the registry from [directory: %s] %s", PHYSFS_getRealDir(filename), filename);
if (PHYSFS_exists(filename)) {
if (!loadFile(filename, &bptr, &filesize)) {
return false; // happens only in NDEBUG case
@ -189,7 +189,7 @@ static BOOL registry_load( const char *filename )
return false;
}
debug(LOG_WZ, "Parsing the registry from %s", filename);
debug(LOG_WZ, "Parsing the registry from [directory: %s] %s", PHYSFS_getRealDir(filename) , filename);
if (filesize == 0 || strlen(bptr) == 0) {
debug(LOG_WARNING, "Registry file %s is empty!", filename);
return false;
@ -237,7 +237,7 @@ static BOOL registry_save( const char *filename )
unsigned int i;
int count = 0;
debug(LOG_WZ, "Saving the registry to %s", filename);
debug(LOG_WZ, "Saving the registry to [directory: %s] %s", PHYSFS_getRealDir(filename), filename);
for (i = 0; i < REGISTRY_HASH_SIZE; ++i) {
regkey_t *j;

View File

@ -301,6 +301,7 @@ void frameShutDown(void)
PHYSFS_file* openLoadFile(const char* fileName, bool hard_fail)
{
PHYSFS_file* fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (!fileHandle)
{
if (hard_fail)

View File

@ -106,7 +106,7 @@ BOOL resLoad(const char *pResFile, SDWORD blockID)
// Note the block id number
resBlockID = blockID;
debug(LOG_WZ, "resLoad: loading %s", pResFile);
debug(LOG_WZ, "resLoad: loading [directory: %s] %s", PHYSFS_getRealDir(pResFile), pResFile);
// Load the RES file; allocate memory for a wrf, and load it
input.type = LEXINPUT_PHYSFS;

View File

@ -110,6 +110,7 @@ BOOL strresLoad(STR_RES* psRes, const char* fileName)
input.type = LEXINPUT_PHYSFS;
input.input.physfsfile = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (!input.input.physfsfile)
{
debug(LOG_ERROR, "strresLoadFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());

View File

@ -264,6 +264,7 @@ static bool init(const char *definition, const char *datafile, bool write)
tag_error = false;
line = 1;
fp = PHYSFS_openRead(definition);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(definition), definition);
sstrcpy(saveDefine, definition);
sstrcpy(saveTarget, datafile);
if (!fp)
@ -317,6 +318,7 @@ static bool init(const char *definition, const char *datafile, bool write)
{
fp = PHYSFS_openRead(datafile);
}
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(datafile), datafile);
handle = fp;
if (!fp)
{

View File

@ -1146,6 +1146,7 @@ UBYTE NETsendFile(BOOL newFile, char *fileName, UDWORD player)
{
// open the file.
pFileHandle = PHYSFS_openRead(fileName); // check file exists
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (pFileHandle == NULL)
{
debug(LOG_ERROR, "Failed");

View File

@ -816,6 +816,7 @@ AUDIO_STREAM* audio_PlayStream(const char* fileName, float volume, void (*onFini
// Open up the file
fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
debug(LOG_ERROR, "sound_LoadTrackFromFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());

View File

@ -81,9 +81,10 @@ static bool cdAudio_OpenTrack(const char* filename)
{
PHYSFS_file* music_file = PHYSFS_openRead(filename);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(filename), filename);
if (music_file == NULL)
{
debug(LOG_ERROR, "Failed opening file %s, with error %s", filename, PHYSFS_getLastError());
debug(LOG_ERROR, "Failed opening file [directory: %s] %s, with error %s", PHYSFS_getRealDir(filename), filename, PHYSFS_getLastError());
return false;
}

View File

@ -466,6 +466,7 @@ TRACK* sound_LoadTrackFromFile(const char *fileName)
// Use PhysicsFS to open the file
fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
debug(LOG_ERROR, "sound_LoadTrackFromFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());

View File

@ -68,6 +68,7 @@ bool PlayList_Read(const char* path)
// Attempt to open the playlist file
fileHandle = PHYSFS_openRead(listName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(listName), listName);
if (fileHandle == NULL)
{
debug(LOG_ERROR, "PHYSFS_openRead(\"%s\") failed with error: %s\n", listName, PHYSFS_getLastError());

View File

@ -220,7 +220,7 @@ BOOL SetUpInputFile(SDWORD nPlayer)
if (!aiSaveFile[nPlayer])
{
debug(LOG_ERROR,"SetUpInputFile(): Couldn't open input file: '%s' for player %d: %s", FileName, nPlayer, PHYSFS_getLastError());
debug(LOG_ERROR,"SetUpInputFile(): Couldn't open input file: [directory: %s] '%s' for player %d: %s", PHYSFS_getRealDir(FileName), FileName, nPlayer, PHYSFS_getLastError());
return false;
}

View File

@ -821,7 +821,7 @@ static BOOL dataAudioCfgLoad(const char* fileName, void **ppData)
{
return true;
}
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
fileHandle = PHYSFS_openRead(fileName);
if (fileHandle == NULL)
@ -840,6 +840,7 @@ static BOOL dataAudioCfgLoad(const char* fileName, void **ppData)
static BOOL dataAnimLoad(const char *fileName, void **ppData)
{
PHYSFS_file* fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
*ppData = NULL;
@ -860,6 +861,7 @@ static BOOL dataAnimCfgLoad(const char *fileName, void **ppData)
PHYSFS_file* fileHandle = PHYSFS_openRead(fileName);
*ppData = NULL;
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
return false;
@ -921,7 +923,7 @@ static BOOL dataScriptLoad(const char* fileName, void **ppData)
scr_lineno = 1;
fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
return false;
@ -970,7 +972,7 @@ static BOOL dataScriptLoadVals(const char* fileName, void **ppData)
debug(LOG_WZ, "Loading script data %s", GetLastResourceFilename());
fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
return false;

View File

@ -282,7 +282,7 @@ BOOL rebuildSearchPath( searchPathMode mode, BOOL force )
}
break;
case mod_campaign:
debug(LOG_WZ, "Switching to campaign mods");
debug(LOG_WZ, "*** Switching to campaign mods ***");
while( curSearchPath )
{
@ -313,7 +313,7 @@ BOOL rebuildSearchPath( searchPathMode mode, BOOL force )
}
break;
case mod_multiplay:
debug(LOG_WZ, "Switching to multiplay mods");
debug(LOG_WZ, "*** Switching to multiplay mods ***");
while( curSearchPath )
{

View File

@ -600,8 +600,8 @@ BOOL loadKeyMap(void)
}
pfile = PHYSFS_openRead(KeyMapPath);
if (!pfile) {
debug(LOG_ERROR, "loadKeyMap: %s could not be opened: %s", KeyMapPath,
PHYSFS_getLastError());
debug(LOG_ERROR, "loadKeyMap: [directory: %s] %s could not be opened: %s", PHYSFS_getRealDir(KeyMapPath),
KeyMapPath, PHYSFS_getLastError());
assert(false);
return false;
}

View File

@ -715,7 +715,7 @@ BOOL levLoadData(const char* name, char *pSaveName, GAME_TYPE saveType)
if (psBaseData->apDataFiles[i])
{
// load the data
debug(LOG_WZ, "Loading %s ...", psBaseData->apDataFiles[i]);
debug(LOG_WZ, "Loading [directory: %s] %s ...", PHYSFS_getRealDir(psBaseData->apDataFiles[i]), psBaseData->apDataFiles[i]);
if (!resLoad(psBaseData->apDataFiles[i], i))
{
return false;

View File

@ -809,6 +809,7 @@ VIEWDATA* loadResearchViewData(const char* fileName)
input.type = LEXINPUT_PHYSFS;
input.input.physfsfile = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (!input.input.physfsfile)
{
debug(LOG_ERROR, "PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());