From ddebf8293a314b79ef9f77d3418375533ce2a6f7 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 18 Mar 2008 11:33:27 +0000 Subject: INTEGRATION: CWS sb83 (1.17.40); FILE MERGED 2007/12/10 15:12:03 sb 1.17.40.1: #i84200# First step of basis/brand split. --- shell/source/unix/exec/shellexec.cxx | 39 +++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'shell/source/unix/exec') diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 3f63ce523674..035d7aa2f3ab 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shellexec.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: ihi $ $Date: 2007-07-11 15:04:25 $ + * last change: $Author: vg $ $Date: 2008-03-18 12:33:27 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -68,6 +68,8 @@ #include #endif +#include + #ifndef _COM_SUN_STAR_URI_XEXTERNALURIREFERENCETRANSLATOR_HPP_ #include #endif @@ -197,11 +199,34 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar #ifdef MACOSX aBuffer.append("open"); #else + // The url launchers are expected to be in the $OOO_BASE_DIR/program + // directory: + com::sun::star::uno::Reference< com::sun::star::util::XMacroExpander > + exp; + if (!(m_xContext->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.util.theMacroExpander"))) + >>= exp) + || !exp.is()) + { + throw SystemShellExecuteException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context fails to supply singleton" + " com.sun.star.util.theMacroExpander of type" + " com.sun.star.util.XMacroExpander")), + static_cast< XSystemShellExecute * >(this), ENOENT); + } OUString aProgramURL; - if ( osl_Process_E_None != osl_getExecutableFile(&aProgramURL.pData) ) + try { + aProgramURL = exp->expandMacros( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/"))); + } catch (com::sun::star::lang::IllegalArgumentException &) { throw SystemShellExecuteException( - OUString(RTL_CONSTASCII_USTRINGPARAM("Cound not determine executable path")), + OUString(RTL_CONSTASCII_USTRINGPARAM("Could not expand $OOO_BASE_DIR path")), static_cast < XSystemShellExecute * > (this), ENOENT ); } @@ -213,12 +238,8 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar static_cast < XSystemShellExecute * > (this), ENOENT ); } - // The url launchers are expected to be in the same directory as the main executable, - // so prefixing the launchers with the path of the executable including the last slash OString aTmp = OUStringToOString(aProgram, osl_getThreadTextEncoding()); - nIndex = aTmp.lastIndexOf('/'); - if (nIndex > 0) - escapeForShell(aBuffer, aTmp.copy(0, nIndex+1)); + escapeForShell(aBuffer, aTmp); // Respect the desktop environment - if there is an executable named // -open-url, pass the url to this one instead -- cgit