Skip to content
Snippets Groups Projects
Commit 448e82f3 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

SL-821: Try to add SecondLife.log file to Mac BugSplat crash report.

Introduce new header file llappviewermacosx-for-objc.h to publish for
llappdelegate-objc.mm and other Objective-C++ consumers the free functions in
llappviewermacosx.cpp they consume. These were never before declared in any
header file. Apparently, to date, we've been trusting to luck that
Objective-C++ will infer the correct signature from calls -- and that the
calls are correct with respect to the function definitions.  :-P

This gives us a place to introduce a new getLogFilePathname() function to
query LLDir. (We don't simply #include "lldir.h" because of the pervasive use
of BOOL in viewer headers; BOOL means something very different in Objective-C++.)
parent f26ba0f0
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
@import BugsplatMac; @import BugsplatMac;
#endif #endif
#include "llwindowmacosx-objc.h" #include "llwindowmacosx-objc.h"
#include "llappviewermacosx-for-objc.h"
#include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's supported) #include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's supported)
@implementation LLAppDelegate @implementation LLAppDelegate
...@@ -189,18 +190,22 @@ ...@@ -189,18 +190,22 @@
return true; return true;
} }
#if 0 // defined(LL_BUGSPLAT) #if defined(LL_BUGSPLAT)
@implementation BugsplatStartupManagerDelegate @implementation BugsplatStartupManagerDelegate
- (BugsplatAttachment *)attachmentForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { - (BugsplatAttachment *)attachmentForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager {
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"example" withExtension:@"json"]; std::string logfile = getLogFilePathname();
NSData *data = [NSData dataWithContentsOfURL:fileURL]; NSString *ns_logfile = [NSString stringWithCString:logfile->c_str()
encoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithContentsOfFile:ns_logfile];
// Apologies for the hard-coded log-file basename, but I do not know the
// incantation for "$(basename "$logfile")" in this language.
BugsplatAttachment *attachment = BugsplatAttachment *attachment =
[[BugsplatAttachment alloc] initWithFilename:@"example.json" [[BugsplatAttachment alloc] initWithFilename:@"SecondLife.log"
attachmentData:data attachmentData:data
contentType:@"application/json"]; contentType:@"text/plain"];
return attachment; return attachment;
} }
......
/**
* @file llappviewermacosx-for-objc.h
* @author Nat Goodspeed
* @date 2018-06-15
* @brief llappviewermacosx.h publishes the C++ API for
* llappviewermacosx.cpp, just as
* llappviewermacosx-objc.h publishes the Objective-C++ API for
* llappviewermacosx-objc.mm.
*
* This header is intended to publish for Objective-C++ consumers a
* subset of the C++ API presented by llappviewermacosx.cpp. It's a
* subset because, if an Objective-C++ consumer were to #include
* the full llappviewermacosx.h, we would almost surely run into
* trouble due to the discrepancy between Objective-C++'s BOOL versus
* classic Microsoft/Linden BOOL.
*
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Copyright (c) 2018, Linden Research, Inc.
* $/LicenseInfo$
*/
#if ! defined(LL_LLAPPVIEWERMACOSX_FOR_OBJC_H)
#define LL_LLAPPVIEWERMACOSX_FOR_OBJC_H
#include <string>
bool initViewer();
void handleUrl(const char* url_utf8);
bool pumpMainLoop();
void handleQuit();
void cleanupViewer();
std::string getLogFilePathname();
#endif /* ! defined(LL_LLAPPVIEWERMACOSX_FOR_OBJC_H) */
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "llappviewermacosx-objc.h" #include "llappviewermacosx-objc.h"
#include "llappviewermacosx.h" #include "llappviewermacosx.h"
#include "llappviewermacosx-for-objc.h"
#include "llwindowmacosx-objc.h" #include "llwindowmacosx-objc.h"
#include "llcommandlineparser.h" #include "llcommandlineparser.h"
...@@ -147,6 +148,11 @@ void cleanupViewer() ...@@ -147,6 +148,11 @@ void cleanupViewer()
gViewerAppPtr = NULL; gViewerAppPtr = NULL;
} }
std::string getLogFilePathname()
{
return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife.log");
}
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
// Store off the command line args for use later. // Store off the command line args for use later.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment