Index: source/fwkutil.cxx =================================================================== RCS file: /cvs/udk/jvmfwk/source/fwkutil.cxx,v retrieving revision 1.23 diff -u -r1.23 fwkutil.cxx --- openoffice.org.orig/jvmfwk/source/fwkutil.cxx 7 Sep 2005 19:35:32 -0000 1.23 +++ openoffice.org/jvmfwk/source/fwkutil.cxx 10 Jul 2006 09:17:29 -0000 @@ -396,6 +396,25 @@ } return ret; } + +static bool iniexists(OUString iniName) +{ + OUString workDir; + + osl_getProcessWorkingDir( &workDir.pData ); + osl::FileBase::getAbsoluteFileURL( workDir, iniName, iniName ); + + // normalize path + osl::FileStatus status( FileStatusMask_FileURL ); + DirectoryItem dirItem; + if (DirectoryItem::E_None != DirectoryItem::get( iniName, dirItem ) || + DirectoryItem::E_None != dirItem.getFileStatus( status )) + { + return false; + } + return true; +} + const rtl::Bootstrap& getBootstrap() { static rtl::Bootstrap *pBootstrap = 0; @@ -403,9 +422,20 @@ if( !pBootstrap ) { rtl::OUStringBuffer buf( 255); - buf.append( getLibraryLocation()); - buf.appendAscii( SAL_CONFIGFILE("/jvmfwk3") ); - sIni = buf.makeStringAndClear(); + if (char *jvmrc = getenv("SAL_JVMFWKRC")) + sIni = rtl::OUString::createFromAscii(jvmrc); + else + { + buf.append(getExecutableDirectory()); + buf.appendAscii( SAL_CONFIGFILE("/jvmfwk3") ); + sIni = buf.makeStringAndClear(); + if (!iniexists(sIni)) + { + buf.append(getLibraryLocation()); + buf.appendAscii( SAL_CONFIGFILE("/jvmfwk3") ); + sIni = buf.makeStringAndClear(); + } + } static rtl::Bootstrap bootstrap(sIni); pBootstrap = &bootstrap; #if OSL_DEBUG_LEVEL >=2 Index: source/bootstrap.cxx =================================================================== RCS file: /cvs/udk/cppuhelper/source/bootstrap.cxx,v retrieving revision 1.24 diff -u -r1.24 bootstrap.cxx --- openoffice.org.orig/cppuhelper/source/bootstrap.cxx 3 Feb 2006 17:12:54 -0000 1.24 +++ openoffice.org/cppuhelper/source/bootstrap.cxx 10 Jul 2006 09:27:45 -0000 @@ -83,6 +86,13 @@ { static void MyDummySymbolWithinLibrary(){} + +rtl::OUString getDirFromFile(const rtl::OUString& usFilePath) +{ + sal_Int32 index= usFilePath.lastIndexOf('/'); + return rtl::OUString(usFilePath.getStr(), index); +} + OUString const & get_this_libpath() { static OUString s_path; @@ -98,13 +108,34 @@ return s_path; } +OUString const & get_this_execpath() +{ + static OUString s_path; + if (0 == s_path.getLength()) + { + fprintf(stderr, "ENTERING\n"); + rtl_uString* sExe = NULL; + if (osl_getExecutableFile(& sExe) != osl_Process_E_NotFound) + { + rtl::OUString ouExe(sExe, SAL_NO_ACQUIRE); + s_path = getDirFromFile(ouExe); + fprintf(stderr, "ANSWER IS %s\n", rtl::OUStringToOString(s_path, RTL_TEXTENCODING_UTF8).getStr()); + } + else + { + fprintf(stderr, "FAILURE\n"); + } + } + return s_path; +} + Bootstrap const & get_unorc() SAL_THROW( () ) { static rtlBootstrapHandle s_bstrap = 0; if (! s_bstrap) { OUString iniName( - get_this_libpath() + OUSTR("/" SAL_CONFIGFILE("uno")) ); + get_this_execpath() + OUSTR("/" SAL_CONFIGFILE("uno")) ); rtlBootstrapHandle bstrap = rtl_bootstrap_args_open( iniName.pData ); ClearableMutexGuard guard( Mutex::getGlobalMutex() ); @@ -514,7 +545,7 @@ throw BootstrapException( OUSTR( "no local component context!" ) ); // URL to office executable - OUString sOfficeURL( get_this_libpath() + OUSTR( "/soffice" ) ); + OUString sOfficeURL( get_this_execpath() + OUSTR( "/soffice" ) ); // create a random pipe name rtlRandomPool hPool = rtl_random_createPool();