diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-03-18 11:33:27 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-03-18 11:33:27 +0000 |
commit | ddebf8293a314b79ef9f77d3418375533ce2a6f7 (patch) | |
tree | d5a19284695de558d50bb1bcd8c40b9f35cef23e /shell/source/unix/exec | |
parent | 86d929492aad312a89ccde7545176aa463092a5c (diff) |
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.
Diffstat (limited to 'shell/source/unix/exec')
-rw-r--r-- | shell/source/unix/exec/shellexec.cxx | 39 |
1 files changed, 30 insertions, 9 deletions
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 <com/sun/star/system/SystemShellExecuteFlags.hpp> #endif +#include <com/sun/star/util/XMacroExpander.hpp> + #ifndef _COM_SUN_STAR_URI_XEXTERNALURIREFERENCETRANSLATOR_HPP_ #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> #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 // <desktop-environement-is>-open-url, pass the url to this one instead |