Index: abi/src/af/xap/win/xap_Win32App.cpp =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32App.cpp,v retrieving revision 1.35 diff -u -r1.35 xap_Win32App.cpp --- abi/src/af/xap/win/xap_Win32App.cpp 2000/02/18 06:51:09 1.35 +++ abi/src/af/xap/win/xap_Win32App.cpp 2000/09/16 12:11:13 @@ -28,6 +28,8 @@ #include "xap_Win32_TB_CFactory.h" #include "xap_Win32Slurp.h" +#pragma warning(disable:4355) + /*****************************************************************/ XAP_Win32App::XAP_Win32App(HINSTANCE hInstance, XAP_Args * pArgs, const char * szAppName) @@ -178,6 +180,7 @@ { char buf[PATH_MAX]; char buf2[PATH_MAX]; + char szApplicationName[PATH_MAX]; const char * sz = NULL; // see if a command line option [-lib ] was given @@ -229,7 +232,8 @@ // /samples/en-US/*.abw // /dictionary/*.hash // - // we want to set the library directory to .../AbiSuite + // we want to set the library directory to the + // directory which stand for .../AbiSuite // (aka "getExeDir()/../..") // // if this is a developer build in the canonical build @@ -263,12 +267,15 @@ while ( (p=strtok(NULL,"\\")) ) v.addItem(p); + strcpy(szApplicationName, getApplicationName()); + strtok(szApplicationName, " "); + int n = v.getItemCount(); if ( (n > 2) && (UT_stricmp((const char *)v.getNthItem(n-1),"bin")==0) - && (UT_stricmp((const char *)v.getNthItem(n-3),"AbiSuite")==0)) + && (UT_stricmp((const char *)v.getNthItem(n-2),szApplicationName)==0)) { - strcat(buf,"\\..\\.."); // TODO trim the string rather than use ..'s + _buildDirName(v, n - 2, buf); XAP_App::_setAbiSuiteLibDir(buf); return; } @@ -276,7 +283,8 @@ if ( (n > 1) && (UT_stricmp((const char *)v.getNthItem(n-1),"bin")==0)) { - strcat(buf,"\\..\\AbiSuite"); // TODO trim the string rather than use ..'s + _buildDirName(v, n - 1, buf); + strcat(buf,"\\AbiSuite"); XAP_App::_setAbiSuiteLibDir(buf); return; } @@ -289,6 +297,26 @@ UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return; +} + +void XAP_Win32App::_buildDirName(const UT_Vector& vDirComponents, UT_uint32 iComponentsNeeded, char* pDirBuf) +{ + UT_ASSERT(iComponentsNeeded <= vDirComponents.getItemCount()); + + if(iComponentsNeeded == 0) + { + strcpy(pDirBuf, "\\"); + return; + } + + UT_uint32 i = 0; + strcpy(pDirBuf, (const char*) vDirComponents.getNthItem(i++)); + + while(--iComponentsNeeded) + { + strcat(pDirBuf, "\\"); + strcat(pDirBuf, (const char*) vDirComponents.getNthItem(i++)); + } } void XAP_Win32App::enableAllTopLevelWindows(UT_Bool b) Index: abi/src/af/xap/win/xap_Win32App.h =================================================================== RCS file: /cvsroot/abi/src/af/xap/win/xap_Win32App.h,v retrieving revision 1.32 diff -u -r1.32 xap_Win32App.h --- abi/src/af/xap/win/xap_Win32App.h 2000/05/26 21:24:49 1.32 +++ abi/src/af/xap/win/xap_Win32App.h 2000/09/16 12:11:14 @@ -69,6 +69,8 @@ protected: UT_uint32 _getExeDir(char* pDirBuf, UT_uint32 iBufLen); void _setAbiSuiteLibDir(void); + + void _buildDirName(const UT_Vector& vDirComponents, UT_uint32 iComponentsNeeded, char* pDirBuf); AP_Win32Toolbar_Icons * m_pWin32ToolbarIcons; HINSTANCE m_hInstance;