tdf#159307 Let non-URIS_ONLY execute() handle .app directories on macOS
Change-Id: I873daed9347b5e5bee4a630474438fce2cc73fec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162768 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
parent
e4cf6c324c
commit
2b1f5fa987
1 changed files with 25 additions and 5 deletions
|
@ -207,12 +207,32 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
|
|||
+ aCommand,
|
||||
getXWeak(), 0);
|
||||
} else {
|
||||
#if defined MACOSX
|
||||
auto usingOpen = false;
|
||||
if (OString pathname8;
|
||||
aCommand.convertToString(
|
||||
&pathname8, RTL_TEXTENCODING_UTF8,
|
||||
RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
|
||||
{
|
||||
if (struct stat st; stat(pathname8.getStr(), &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
usingOpen = true;
|
||||
aBuffer.append("open -a ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
escapeForShell(aBuffer, OUStringToOString(aCommand, osl_getThreadTextEncoding()));
|
||||
aBuffer.append(" ");
|
||||
if( nFlags != 42 )
|
||||
escapeForShell(aBuffer, OUStringToOString(aParameter, osl_getThreadTextEncoding()));
|
||||
else
|
||||
aBuffer.append(OUStringToOString(aParameter, osl_getThreadTextEncoding()));
|
||||
if (!aParameter.isEmpty()) {
|
||||
aBuffer.append(" ");
|
||||
#if defined MACOSX
|
||||
if (usingOpen) {
|
||||
aBuffer.append("--args ");
|
||||
}
|
||||
#endif
|
||||
if( nFlags != 42 )
|
||||
escapeForShell(aBuffer, OUStringToOString(aParameter, osl_getThreadTextEncoding()));
|
||||
else
|
||||
aBuffer.append(OUStringToOString(aParameter, osl_getThreadTextEncoding()));
|
||||
}
|
||||
}
|
||||
|
||||
// Prefer DESKTOP_LAUNCH when available
|
||||
|
|
Loading…
Reference in a new issue