diff options
-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. |