diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2018-06-15 16:48:20 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2018-06-15 16:48:20 -0400 |
commit | 448e82f39c472c82620bb52e0644e258b363d562 (patch) | |
tree | 9e72eae4aa32322768d2b0cd8fc20e9f06a11370 | |
parent | f26ba0f0eccce2e6b66554dc1132ff29e6d0f3b1 (diff) |
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++.)
-rw-r--r-- | indra/newview/llappdelegate-objc.mm | 17 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx-for-objc.h | 34 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx.cpp | 6 |
3 files changed, 51 insertions, 6 deletions
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index 8e1ad169c9..ad5398721b 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -29,6 +29,7 @@ @import BugsplatMac; #endif #include "llwindowmacosx-objc.h" +#include "llappviewermacosx-for-objc.h" #include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's supported) @implementation LLAppDelegate @@ -189,18 +190,22 @@ return true; } -#if 0 // defined(LL_BUGSPLAT) +#if defined(LL_BUGSPLAT) @implementation BugsplatStartupManagerDelegate - (BugsplatAttachment *)attachmentForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { - NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"example" withExtension:@"json"]; - NSData *data = [NSData dataWithContentsOfURL:fileURL]; - + std::string logfile = getLogFilePathname(); + 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 alloc] initWithFilename:@"example.json" + [[BugsplatAttachment alloc] initWithFilename:@"SecondLife.log" attachmentData:data - contentType:@"application/json"]; + contentType:@"text/plain"]; return attachment; } diff --git a/indra/newview/llappviewermacosx-for-objc.h b/indra/newview/llappviewermacosx-for-objc.h new file mode 100644 index 0000000000..ef5d90bfef --- /dev/null +++ b/indra/newview/llappviewermacosx-for-objc.h @@ -0,0 +1,34 @@ +/** + * @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) */ diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index d472f8926b..cdbdb23d9a 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -36,6 +36,7 @@ #include "llappviewermacosx-objc.h" #include "llappviewermacosx.h" +#include "llappviewermacosx-for-objc.h" #include "llwindowmacosx-objc.h" #include "llcommandlineparser.h" @@ -147,6 +148,11 @@ void cleanupViewer() gViewerAppPtr = NULL; } +std::string getLogFilePathname() +{ + return gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SecondLife.log"); +} + int main( int argc, char **argv ) { // Store off the command line args for use later. |