summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewermacosx.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-03-20 21:41:26 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-03-20 21:41:26 +0000
commite3b97ac65b10a58c1dac041743e4acd1042492f5 (patch)
tree1648189fd15e51ac1c2eb8d8018faa775c93f6d3 /indra/newview/llappviewermacosx.cpp
parentb502c86f30d3ed01b795548364ab8090363eeac5 (diff)
merge release@82383 viewer-cleanup2-7-merge@82828
QAR-369
Diffstat (limited to 'indra/newview/llappviewermacosx.cpp')
-rw-r--r--indra/newview/llappviewermacosx.cpp68
1 files changed, 60 insertions, 8 deletions
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 2d7091a075..1e4c08a1c1 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -36,15 +36,25 @@
#endif
#include "llappviewermacosx.h"
+#include "llcommandlineparser.h"
+
#include "llmemtype.h"
#include "llviewernetwork.h"
+#include "llviewercontrol.h"
#include "llmd5.h"
#include "llurlsimstring.h"
#include "llfloaterworldmap.h"
#include "llurldispatcher.h"
#include <Carbon/Carbon.h>
+namespace
+{
+ // The command line args stored.
+ // They are not used immediately by the app.
+ int gArgC;
+ char** gArgV;
+}
int main( int argc, char **argv )
{
@@ -61,14 +71,11 @@ int main( int argc, char **argv )
viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
- bool ok = viewer_app_ptr->tempStoreCommandOptions(argc, argv);
- if(!ok)
- {
- llwarns << "Unable to parse command line." << llendl;
- return -1;
- }
-
- ok = viewer_app_ptr->init();
+ // Store off the command line args for use later.
+ gArgC = argc;
+ gArgV = argv;
+
+ bool ok = viewer_app_ptr->init();
if(!ok)
{
llwarns << "Application init failed." << llendl;
@@ -108,6 +115,51 @@ bool LLAppViewerMacOSX::init()
return LLAppViewer::init();
}
+bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp)
+{
+ // First parse the command line, not often used on the mac.
+ clp.parseCommandLine(gArgC, gArgV);
+
+ // Now read in the args from arguments txt.
+ // Succesive calls to clp.parse... will NOT override earlier
+ // options.
+ const char* filename = "arguments.txt";
+ llifstream ifs(filename, llifstream::binary);
+ if (!ifs.is_open())
+ {
+ llwarns << "Unable to open file" << filename << llendl;
+ return false;
+ }
+
+ clp.parseCommandLineFile(ifs);
+
+ // Get the user's preferred language string based on the Mac OS localization mechanism.
+ // To add a new localization:
+ // go to the "Resources" section of the project
+ // get info on "language.txt"
+ // in the "General" tab, click the "Add Localization" button
+ // create a new localization for the language you're adding
+ // set the contents of the new localization of the file to the string corresponding to our localization
+ // (i.e. "en-us", "ja", etc. Use the existing ones as a guide.)
+ CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
+ char path[MAX_PATH];
+ if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
+ {
+ LLString lang;
+ if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/
+ {
+ LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
+ if(c)
+ {
+ c->setValue(lang, false);
+ }
+ }
+ }
+ CFRelease(url);
+
+ return true;
+}
+
void LLAppViewerMacOSX::handleCrashReporting()
{
// Macintosh