Improve the messages for path problems

C4Group::Open would sometimes overwrite more specific error messages or
not mention the problematic path. DirectoryIterator::Read also now mentions
more detail. Two superfluous messages were removed to make space.
issue1247
Günther Brammer 2014-05-26 02:36:40 +02:00
parent 13d9608f9e
commit 8780a69b51
6 changed files with 18 additions and 22 deletions

View File

@ -559,7 +559,7 @@ bool C4Group::Open(const char *szGroupName, bool fCreate)
char szRealGroup[_MAX_FNAME];
SCopy(szGroupNameN,szRealGroup,_MAX_FNAME);
do
{ if (!TruncatePath(szRealGroup)) return Error("Open: File not found"); }
{ if (!TruncatePath(szRealGroup)) return Error(FormatString("Open(\"%s\"): File not found", szGroupNameN).getData()); }
while (!FileExists(szRealGroup));
// Open mother and child in exclusive mode
@ -568,9 +568,9 @@ bool C4Group::Open(const char *szGroupName, bool fCreate)
return Error("Open: mem");
pMother->SetStdOutput(StdOutput);
if (!pMother->Open(szRealGroup))
{ Clear(); return Error("Open: Cannot open mother"); }
{ Clear(); Error(pMother->ErrorString); delete pMother; return false; }
if (!OpenAsChild(pMother,szGroupNameN+SLen(szRealGroup)+1,true))
{ Clear(); return Error("Open:: Cannot open as child"); }
{ Clear(); return false; }
// Success
return true;

View File

@ -456,20 +456,15 @@ void C4ConfigGeneral::DeterminePaths()
SCopy(ExePath.getMData(),SystemDataPath);
#elif defined(__APPLE__)
SCopy(::Application.GetGameDataPath().getData(),SystemDataPath);
#else
#ifdef OC_SYSTEM_DATA_DIR
#ifdef WITH_AUTOMATIC_UPDATE
#elif defined(WITH_AUTOMATIC_UPDATE)
// WITH_AUTOMATIC_UPDATE builds are our tarball releases and
// development snapshots, i.e. where the game data is at the
// same location as the executable.
SCopy(ExePath.getMData(),SystemDataPath);
#else
#elif defined(OC_SYSTEM_DATA_DIR)
SCopy(OC_SYSTEM_DATA_DIR, SystemDataPath);
#endif
#else
#error Please define OC_SYSTEM_DATA_DIR!
#endif
#endif
AppendBackslash(SystemDataPath);

View File

@ -95,15 +95,23 @@ bool C4Application::DoInit(int argc, char * argv[])
Config.Load();
}
}
// Open log
OpenLog();
Revision.Ref(C4REVISION);
// Engine header message
Log(C4ENGINEINFOLONG);
LogF("Version: %s %s (%s)", C4VERSION, C4_OS, Revision.getData());
LogF("ExePath: \"%s\"", Config.General.ExePath.getData());
LogF("SystemDataPath: \"%s\"", Config.General.SystemDataPath);
LogF("UserDataPath: \"%s\"", Config.General.UserDataPath);
// Init C4Group
C4Group_SetProcessCallback(&ProcessCallback);
C4Group_SetTempPath(Config.General.TempPath.getData());
C4Group_SetSortList(C4CFN_FLS);
// Open log
OpenLog();
Revision.Ref(C4REVISION);
// Initialize game data paths
Reloc.Init();
@ -161,10 +169,6 @@ bool C4Application::DoInit(int argc, char * argv[])
// init timers (needs window)
Add(pGameTimer = new C4ApplicationGameTimer());
// Engine header message
Log(C4ENGINEINFOLONG);
LogF("Version: %s %s (%s)", C4VERSION, C4_OS, Revision.getData());
// Initialize OpenGL
bool success = DDrawInit(this, !!isEditor, false, GetConfigWidth(), GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.Monitor);
if (!success) { LogFatal(LoadResStr("IDS_ERR_DDRAW")); Clear(); ShowGfxErrorDialog(); return false; }

View File

@ -1220,8 +1220,6 @@ bool C4Draw::Init(C4AbstractApp * pApp, bool Editor, bool fUsePageLock, unsigned
if (!CreatePrimarySurfaces(Editor, iXRes, iYRes, iBitDepth, iMonitor))
return false;
DebugLog(" Create Clipper");
if (!CreatePrimaryClipper(iXRes, iYRes))
return Error(" Clipper failure.");

View File

@ -76,7 +76,6 @@ bool C4AbstractApp::Init(int argc, char * argv[])
}
if (Priv->xrandr_major_version >= 0)
{
LogF("Using XRandR version %d.%d", Priv->xrandr_major_version, Priv->xrandr_minor_version);
XRRSelectInput(dpy, DefaultRootWindow(dpy), RRScreenChangeNotifyMask);
}
else

View File

@ -1014,7 +1014,7 @@ void DirectoryIterator::Read(const char *dirname)
return;
default:
// Something else broke
Log("DirectoryIterator::Read(const char*): Unable to read file system");
LogF("DirectoryIterator::Read(\"%s\"): %s", dirname, strerror(errno));
return;
}
}