diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-03-18 11:16:42 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-03-18 11:16:42 +0000 |
commit | 259a7cbf78aba37aef5c4561099cb1542a027b5d (patch) | |
tree | 9417ae813d61a6d3122a3fc3345096527e323b05 /extensions/source/plugin/unx/sysplug.cxx | |
parent | e0b8d2bd1d7657e1a8b812bf00ebb90c0ec0f54d (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/source/plugin/unx/sysplug.cxx')
-rw-r--r-- | extensions/source/plugin/unx/sysplug.cxx | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx index f00957f34..9acaafb9f 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)); +} |