From f0ed8716b3b2556cb86e8005be88922c594c1189 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Thu, 10 Sep 2009 22:44:47 +0000 Subject: CWS-TOOLING: integrate CWS os2port06dev300 2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree. --- shell/source/unix/exec/shellexec.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'shell/source/unix/exec') diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 315f78c517ff..4ee0f32eb072 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -97,12 +97,10 @@ void escapeForShell( rtl::OStringBuffer & rBuffer, const rtl::OString & rURL) { // escape every non alpha numeric characters (excluding a few "known good") by prepending a '\' sal_Char c = rURL[n]; - if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) -#ifdef OS2 // YD we don't need to escape ':', '-', '\\', '_' - && c != ':' && c != '-' && c != '\\' && c != '_' -#endif - && c != '/' && c != '.' ) +#ifndef OS2 // YD shell does not support escaped chars + if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '/' && c != '.' ) rBuffer.append( '\\' ); +#endif rBuffer.append( c ); } @@ -210,6 +208,19 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar static_cast < XSystemShellExecute * > (this), ENOENT ); } +#ifdef OS2 + OStringBuffer aProg = OUStringToOString(aProgram, osl_getThreadTextEncoding()); + aProg.append("open-url.exe"); + OString aUrl = OUStringToOString(aURL, osl_getThreadTextEncoding()); + if ( -1 == spawnl(P_NOWAIT, aProg.getStr(), aProg.getStr(), aUrl.getStr() , NULL) ) + { + int nerr = errno; + throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ), + static_cast < XSystemShellExecute * > (this), nerr ); + } + return; +#endif + OString aTmp = OUStringToOString(aProgram, osl_getThreadTextEncoding()); escapeForShell(aBuffer, aTmp); -- cgit