Launch transcripts in external text editor on mac too

This commit is contained in:
Cinder
2014-04-21 18:05:45 -04:00
parent d5d0473487
commit a4c672252d
4 changed files with 21 additions and 5 deletions

View File

@@ -3277,7 +3277,7 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async)
llinfos << "Opening URL " << escaped_url << llendl; 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) if (stringRef)
{ {
// This will succeed if the string is a full URL, including the http:// // 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); 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 LLWindowMacOSX::getNativeKeyData()
{ {
LLSD result = LLSD::emptyMap(); LLSD result = LLSD::emptyMap();

View File

@@ -116,6 +116,7 @@ public:
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
/*virtual*/ void setTitle(const std::string &title); /*virtual*/ void setTitle(const std::string &title);
/*virtual*/ void ShellEx(const std::string& command);
static std::vector<std::string> getDynamicFallbackFontList(); static std::vector<std::string> getDynamicFallbackFontList();

View File

@@ -3329,9 +3329,9 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t
return retval; 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 ); llutf16string url_utf16 = wstring_to_utf16str( url_wstring );
SHELLEXECUTEINFO sei = { sizeof( sei ) }; SHELLEXECUTEINFO sei = { sizeof( sei ) };

View File

@@ -1002,10 +1002,10 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
void show_log_browser(const std::string& name, const std::string& id) 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")) if (gSavedSettings.getBOOL("LiruLegacyLogLaunch"))
{ {
gViewerWindow->getWindow()->ShellEx("\"" + LLLogChat::makeLogFileName(name) + "\""); gViewerWindow->getWindow()->ShellEx(LLLogChat::makeLogFileName(name));
return; return;
} }
#endif #endif