summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-06-09 11:23:43 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-06-09 11:23:43 +0000
commit27f85e61a4c9c90cfa43da26749ca1b61782fbef (patch)
tree01335669d4df259015c3e506bdba3af5b39adaa1 /cppuhelper
parent515bc1bf6159e6e560af4ec97e081a4cefea5f8a (diff)
INTEGRATION: CWS sb87 (1.30.28); FILE MERGED
2008/04/24 13:02:20 sb 1.30.28.2: RESYNC: (1.30-1.31); FILE MERGED 2008/04/24 11:49:16 sb 1.30.28.1: #i88687# in cppu::bootstrap, use new cppuhelper_detail_findSofficePath to locate soffice and bootstrap into its UNO environment
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/bootstrap.cxx41
1 files changed, 36 insertions, 5 deletions
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 831adf084f11..a416995193f1 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: bootstrap.cxx,v $
- * $Revision: 1.32 $
+ * $Revision: 1.33 $
*
* This file is part of OpenOffice.org.
*
@@ -53,6 +53,7 @@
#include "cppuhelper/bootstrap.hxx"
#include "cppuhelper/component_context.hxx"
#include "cppuhelper/access_control.hxx"
+#include "cppuhelper/findsofficepath.h"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
@@ -508,15 +509,45 @@ Reference< XComponentContext > SAL_CALL bootstrap()
try
{
+ char const * p1 = cppuhelper_detail_findSofficePath();
+ if (p1 == NULL) {
+ throw BootstrapException(
+ OUSTR("no soffice installation found!"));
+ }
+ rtl::OUString p2;
+ if (!rtl_convertStringToUString(
+ &p2.pData, p1, strlen(p1), osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw BootstrapException(
+ OUSTR("bad characters in soffice installation path!"));
+ }
+ OUString path;
+ if (osl::FileBase::getFileURLFromSystemPath(p2, path) !=
+ osl::FileBase::E_None)
+ {
+ throw BootstrapException(
+ OUSTR("cannot convert soffice installation path to URL!"));
+ }
+ if (path.getLength() > 0 && path[path.getLength() - 1] != '/') {
+ path += OUSTR("/");
+ }
+
+ OUString uri;
+ if (!Bootstrap::get(OUSTR("URE_BOOTSTRAP"), uri)) {
+ Bootstrap::set(
+ OUSTR("URE_BOOTSTRAP"),
+ Bootstrap::encode(path + OUSTR(SAL_CONFIGFILE("fundamental"))));
+ }
+
// create default local component context
Reference< XComponentContext > xLocalContext(
defaultBootstrap_InitialComponentContext() );
if ( !xLocalContext.is() )
throw BootstrapException( OUSTR( "no local component context!" ) );
- // URL to office executable
- OUString sOfficeURL( get_this_libpath() + OUSTR( "/soffice" ) );
-
// create a random pipe name
rtlRandomPool hPool = rtl_random_createPool();
if ( hPool == 0 )
@@ -560,7 +591,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
// start office process
oslProcess hProcess = 0;
oslProcessError rc = osl_executeProcess(
- sOfficeURL.pData, ar_args, ARLEN( ar_args ),
+ (path + OUSTR("soffice")).pData, ar_args, ARLEN( ar_args ),
osl_Process_DETACHED,
sec.getHandle(),
0, // => current working dir