summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-03-18 11:16:42 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-03-18 11:16:42 +0000
commit5dee8aac0d9ea4f3c79031747862413524adacd5 (patch)
tree44f4cecdd79223e9775d8f54ff3ad19d7b2ceba7 /extensions
parent6c1121f370898b43fb5b3acb10fc7ce5fd3950ca (diff)
INTEGRATION: CWS sb83 (1.8.16); FILE MERGED
2008/02/12 08:36:10 sb 1.8.16.1: #i86033# call pluginapp.bin with full path
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/plugin/unx/sysplug.cxx34
1 files changed, 28 insertions, 6 deletions
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
index f00957f34448..9acaafb9fbf9 100644
--- a/extensions/source/plugin/unx/sysplug.cxx
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: sysplug.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: ihi $ $Date: 2008-01-14 14:54:16 $
+ * last change: $Author: vg $ $Date: 2008-03-18 12:16:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -40,7 +40,9 @@
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
+#include <osl/file.hxx>
#include <osl/thread.h>
+#include <rtl/bootstrap.hxx>
#include <plugin/impl.hxx>
@@ -61,11 +63,17 @@ UnxPluginComm::UnxPluginComm(
sprintf( pWindow, "%d", (int)aParent );
sprintf( pDesc, "%d", nDescriptor1 );
ByteString aLib( library, osl_getThreadTextEncoding() );
+ rtl::OString path;
+ if (!getPluginappPath(&path)) {
+ fprintf( stderr, "cannot construct path to pluginapp.bin\n" );
+ m_nCommPID = -1;
+ return;
+ }
- char* pArgs[5];
- pArgs[0] = const_cast<char*>("pluginapp.bin");
+ char const* pArgs[5];
+ pArgs[0] = path.getStr();
pArgs[1] = pDesc;
- pArgs[2] = const_cast<char*>(aLib.GetBuffer());
+ pArgs[2] = aLib.GetBuffer();
pArgs[3] = pWindow;
pArgs[4] = NULL;
@@ -76,7 +84,7 @@ UnxPluginComm::UnxPluginComm(
if( ! ( m_nCommPID = fork() ) )
{
- execvp( pArgs[0], pArgs );
+ execvp( pArgs[0], const_cast< char ** >(pArgs) );
fprintf( stderr, "Error: could not exec %s\n", pArgs[0] );
_exit(255);
}
@@ -115,3 +123,17 @@ UnxPluginComm::~UnxPluginComm()
#endif
}
}
+
+bool UnxPluginComm::getPluginappPath(rtl::OString * path) {
+ OSL_ASSERT(path != NULL);
+ rtl::OUString p(
+ RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/pluginapp.bin"));
+ rtl::Bootstrap::expandMacros(p);
+ return
+ (osl::FileBase::getSystemPathFromFileURL(p, p) ==
+ osl::FileBase::E_None) &&
+ p.convertToString(
+ path, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR));
+}