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
This commit is contained in:
Vladimir Glazounov 2008-03-18 11:16:42 +00:00
parent 6c1121f370
commit 5dee8aac0d

View file

@ -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));
}