diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-06-01 07:58:42 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-06-01 07:58:42 +0000 |
commit | ee0c5a96d4c341c62933d9c070b37c4621787b97 (patch) | |
tree | 52711c5adf6f216da59fa57fcaacbaba6d5feab9 /psprint | |
parent | cd93db597354162438dacd5e9c3b8c152ab7bd84 (diff) |
INTEGRATION: CWS jl6 (1.19.12); FILE MERGED
2004/05/04 15:35:21 jl 1.19.12.1: #109765# use new jvmfwk to find JRE installation
Diffstat (limited to 'psprint')
-rw-r--r-- | psprint/source/helper/helper.cxx | 99 |
1 files changed, 24 insertions, 75 deletions
diff --git a/psprint/source/helper/helper.cxx b/psprint/source/helper/helper.cxx index 44827f7a3eae..52fc77d658a8 100644 --- a/psprint/source/helper/helper.cxx +++ b/psprint/source/helper/helper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: helper.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: obo $ $Date: 2004-03-17 10:50:28 $ + * last change: $Author: obo $ $Date: 2004-06-01 08:58:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ #include <rtl/bootstrap.hxx> #include <sal/config.h> #ifdef SOLAR_JAVA -#include "jvmaccess/javainfo.hxx" +#include <jvmfwk/framework.h> #endif // SOLAR_JAVA #ifdef MACOSX @@ -247,87 +247,36 @@ const OUString& psp::getFontPath() // append jre/jdk fonts if possible OString aJREpath; - if( aUserPath.getLength() ) - { - OUString aJavaRc( aUserPath ); - aJavaRc += OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/config/" SAL_CONFIGFILE( "java" ) ) ); - Config aConfig( aJavaRc ); - aConfig.SetGroup( "Java" ); - aJREpath = aConfig.ReadKey( "Home" ); - if( ! aJREpath.getLength() ) - { - aJavaRc = aNetPath; - aJavaRc += OUString( RTL_CONSTASCII_USTRINGPARAM( "/share/config/" SAL_CONFIGFILE("java") ) ); - Config aShareConfig( aJavaRc ); - aShareConfig.SetGroup( "Java" ); - aJREpath = aShareConfig.ReadKey( "Home" ); - } - if( aJREpath.compareTo( "file:", 5 ) == 0 ) - { - OUString aURL( OStringToOUString( aJREpath, osl_getThreadTextEncoding() ) ); - OUString aSys; - if( osl_getSystemPathFromFileURL( aURL.pData, &aSys.pData ) == osl_File_E_None ) - aJREpath = OUStringToOString( aSys, osl_getThreadTextEncoding() ); - } +#ifdef SOLAR_JAVA + JavaInfo * pInfo = NULL; + javaFrameworkError jerr = jfw_getSelectedJRE( & pInfo); + if (jerr == JFW_E_NONE && pInfo != NULL) + { + OUString aSys; + if( osl_getSystemPathFromFileURL( pInfo->sLocation, &aSys.pData ) == osl_File_E_None ) + aJREpath = OUStringToOString( aSys, osl_getThreadTextEncoding() ); + } + jfw_freeJavaInfo(pInfo); +#endif - if( aJREpath.getLength() > 0 ) + if( aJREpath.getLength() > 0 ) + { + OString aTestPath( aJREpath ); + aTestPath += "/jre/lib/fonts"; + if( access( aTestPath.getStr(), R_OK ) ) { - OString aTestPath( aJREpath ); - aTestPath += "/jre/lib/fonts"; + aTestPath = aJREpath; + aTestPath += "/lib/fonts"; if( access( aTestPath.getStr(), R_OK ) ) - { - aTestPath = aJREpath; - aTestPath += "/lib/fonts"; - if( access( aTestPath.getStr(), R_OK ) ) - aJREpath = OString(); - else - aJREpath = aTestPath; - } + aJREpath = OString(); else aJREpath = aTestPath; } + else + aJREpath = aTestPath; } -#ifdef SOLAR_JAVA - // if no javarc (e.g. in setup) exists or it failed try the UDK method - if( ! aJREpath.getLength() ) - { - OString aJavaLib; - try - { - OUString aLib; - if (osl::FileBase::getSystemPathFromFileURL( - jvmaccess::JavaInfo::createBestInfo(true). - getRuntimeLibLocation(), - aLib) - == osl::FileBase::E_None) - aLib.convertToString( - &aJavaLib, osl_getThreadTextEncoding(), - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR - | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR); - } - catch (jvmaccess::JavaInfo::InitException &) - {} - - if (aJavaLib.getLength() != 0) - { - sal_Int32 nIndex; - while( ( nIndex = aJavaLib.lastIndexOf( '/' ) ) != -1 ) - { - aJavaLib = aJavaLib.copy( 0, nIndex ); - OString aTmpPath = aJavaLib; - aTmpPath += "/lib/fonts"; - if( access( aTmpPath.getStr(), R_OK ) == 0 ) - { - aJREpath = aTmpPath; - break; - } - } - } - } -#endif // SOLAR_JAVA - if( aJREpath.getLength() ) { aPath += OUString( RTL_CONSTASCII_USTRINGPARAM( ";" ) ); |