From e3b97ac65b10a58c1dac041743e4acd1042492f5 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 20 Mar 2008 21:41:26 +0000 Subject: merge release@82383 viewer-cleanup2-7-merge@82828 QAR-369 --- indra/newview/llappviewermacosx.cpp | 68 ++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 8 deletions(-) (limited to 'indra/newview/llappviewermacosx.cpp') 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 +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 -- cgit v1.2.3