diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 91e4c00cf..fd4411f57 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -3277,7 +3277,7 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) llinfos << "Opening URL " << escaped_url << llendl; - CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8); + CFStringRef stringRef = CFStringCreateWithBytes(NULL, (UInt8 *)escaped_url.c_str(), strlen(escaped_url.c_str()), kCFStringEncodingUTF8, false); if (stringRef) { // This will succeed if the string is a full URL, including the http:// @@ -3315,6 +3315,21 @@ void LLWindowMacOSX::setTitle(const std::string &title) SetWindowTitleWithCFString(mWindow, title_str); } +// virtual +void LLWindowMacOSX::ShellEx(const std::string& command) +{ + char * path = NULL; + asprintf(&path, "%s %s", (char*)"file://", command.c_str()); + CFURLRef url = CFURLCreateAbsoluteURLWithBytes(NULL, (UInt8 *)path, strlen(path), + kCFURLPOSIXPathStyle, NULL, true); + if (url != NULL) + { + LSOpenCFURLRef(url, NULL); + CFRelease(url); + } + free(path); +} + LLSD LLWindowMacOSX::getNativeKeyData() { LLSD result = LLSD::emptyMap(); diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 7f7181a58..d8d46edb9 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -116,6 +116,7 @@ public: /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); /*virtual*/ void setTitle(const std::string &title); + /*virtual*/ void ShellEx(const std::string& command); static std::vector getDynamicFallbackFontList(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8e6b4c57c..aceb1a4fa 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3329,9 +3329,9 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t return retval; } -void LLWindowWin32::ShellEx(const std::string& command ) +void LLWindowWin32::ShellEx(const std::string& command) { - LLWString url_wstring = utf8str_to_wstring( command ); + LLWString url_wstring = utf8str_to_wstring( "\"" + command + "\"" ); llutf16string url_utf16 = wstring_to_utf16str( url_wstring ); SHELLEXECUTEINFO sei = { sizeof( sei ) }; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 9603208c7..855b82d58 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1002,10 +1002,10 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) void show_log_browser(const std::string& name, const std::string& id) { -#if LL_WINDOWS // Singu TODO: Other platforms? +#if LL_WINDOWS || LL_DARWIN // Singu TODO: Linux? if (gSavedSettings.getBOOL("LiruLegacyLogLaunch")) { - gViewerWindow->getWindow()->ShellEx("\"" + LLLogChat::makeLogFileName(name) + "\""); + gViewerWindow->getWindow()->ShellEx(LLLogChat::makeLogFileName(name)); return; } #endif