This could be resolved if you were to extract the 'path' the exe is running in and build filenames using the path. I'am not sure if allegro supports such a thing as i'am just not interested in learning the allegro lib, but I do have a code snip that should solve it.
Code: Select all
#if defined TA3D_PLATFORM_WINDOWS
void ExtractPathFile( const String &szFullFileName, String &szFile, String &szDir )
{
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
// Below extracts our path where the application is being run.
::_splitpath_s( szFullFileName.c_str(), drive, dir, fname, ext );
szFile = fname;
szDir = drive;
szDir += dir;
}
#end if
String GetClientPath( void )
{
static bool bName = false;
static String szName = _T("UNAVAILABLE");
if (!bName)
{
#if defined TA3D_PLATFORM_WINDOWS
char fPath[ MAX_PATH ];
String Tmp;
::GetModuleFileName( NULL, fPath, MAX_PATH );
ExtractPathFile( fPath, Tmp, szName );
#else
szName = ""
#end if
bName = true;
}
return szName;
}
This could be placed in our namespace file (you don't have it yet but i'll send it to you soon). To use it we would need to adjust all places where it loads filenames to use 'std strings' as inputs and then pass it.
from:
Code: Select all
translation_manager.load( "ta3d.res" );
Code: Select all
translation_manager.load( GetClientPath() + "ta3d.res" );
Also i'am almost appalled that there is next to know error handling in this code, if it fails to find a file it just keeps going without it, if it fails a check it just keeps going, not messages, no warnings nothing, eventually crashing down the line. We seriously need to look at this stuff.
Unless I can have 100% access to the code for a few days i'am not oging to bother as i've made so many changes lately, and most will soon be lost, but the key 3 I want to keep I will upload to you.
I'am going to get on my knees here and beg you to lets examine the code now before we get too much further. If we continue on our path we are headed the same avenu as spring is at now. And that is with such a beast of a code that its nearly impossible to do anything with, its lacks flexability and is poorly written.
Another thing is, some things are using allegro calls over stl calls. Now if you want to use allegro thats fine and i'll back you on it, I won't take myself to learn it but I will back your decession, however anywhere where an STL use can be done, it should be chosen over allegro. Keep in mind in many cases all allgro is doing is wrapping itself around platform specific code anyhow, so all you end up doing is adding a sorta 3rd party kludge call.
Chat with ya soon.
++Cire.