aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llappviewermacosx.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llappviewermacosx.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llappviewermacosx.cpp101
1 files changed, 93 insertions, 8 deletions
diff --git a/linden/indra/newview/llappviewermacosx.cpp b/linden/indra/newview/llappviewermacosx.cpp
index e277425..c128634 100644
--- a/linden/indra/newview/llappviewermacosx.cpp
+++ b/linden/indra/newview/llappviewermacosx.cpp
@@ -36,15 +36,25 @@
36#endif 36#endif
37 37
38#include "llappviewermacosx.h" 38#include "llappviewermacosx.h"
39#include "llcommandlineparser.h"
40
39#include "llmemtype.h" 41#include "llmemtype.h"
40 42
41#include "llviewernetwork.h" 43#include "llviewernetwork.h"
44#include "llviewercontrol.h"
42#include "llmd5.h" 45#include "llmd5.h"
43#include "llurlsimstring.h" 46#include "llurlsimstring.h"
44#include "llfloaterworldmap.h" 47#include "llfloaterworldmap.h"
45#include "llurldispatcher.h" 48#include "llurldispatcher.h"
46#include <Carbon/Carbon.h> 49#include <Carbon/Carbon.h>
47 50
51namespace
52{
53 // The command line args stored.
54 // They are not used immediately by the app.
55 int gArgC;
56 char** gArgV;
57}
48 58
49int main( int argc, char **argv ) 59int main( int argc, char **argv )
50{ 60{
@@ -61,14 +71,11 @@ int main( int argc, char **argv )
61 71
62 viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash); 72 viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
63 73
64 bool ok = viewer_app_ptr->tempStoreCommandOptions(argc, argv); 74 // Store off the command line args for use later.
65 if(!ok) 75 gArgC = argc;
66 { 76 gArgV = argv;
67 llwarns << "Unable to parse command line." << llendl; 77
68 return -1; 78 bool ok = viewer_app_ptr->init();
69 }
70
71 ok = viewer_app_ptr->init();
72 if(!ok) 79 if(!ok)
73 { 80 {
74 llwarns << "Application init failed." << llendl; 81 llwarns << "Application init failed." << llendl;
@@ -108,6 +115,84 @@ bool LLAppViewerMacOSX::init()
108 return LLAppViewer::init(); 115 return LLAppViewer::init();
109} 116}
110 117
118// MacOSX may add and addition command line arguement for the process serial number.
119// The option takes a form like '-psn_0_12345'. The following method should be able to recognize
120// and either ignore or return a pair of values for the option.
121// look for this method to be added to the parser in parseAndStoreResults.
122std::pair<std::string, std::string> parse_psn(const std::string& s)
123{
124 if (s.find("-psn_") == 0)
125 {
126 // *FIX:Mani Not sure that the value makes sense.
127 // fix it once the actual -psn_XXX syntax is known.
128 return std::make_pair("psn", s.substr(5));
129 }
130 else
131 {
132 return std::make_pair(std::string(), std::string());
133 }
134}
135
136bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp)
137{
138 // The next two lines add the support for parsing the mac -psn_XXX arg.
139 clp.addOptionDesc("psn", NULL, 1, "MacOSX process serial number");
140 clp.setCustomParser(parse_psn);
141
142 // First parse the command line, not often used on the mac.
143 if(clp.parseCommandLine(gArgC, gArgV) == false)
144 {
145 return false;
146 }
147
148 // Now read in the args from arguments txt.
149 // Succesive calls to clp.parse... will NOT override earlier
150 // options.
151 const char* filename = "arguments.txt";
152 llifstream ifs(filename, llifstream::binary);
153 if (!ifs.is_open())
154 {
155 llwarns << "Unable to open file" << filename << llendl;
156 return false;
157 }
158
159 if(clp.parseCommandLineFile(ifs) == false)
160 {
161 return false;
162 }
163
164 // Get the user's preferred language string based on the Mac OS localization mechanism.
165 // To add a new localization:
166 // go to the "Resources" section of the project
167 // get info on "language.txt"
168 // in the "General" tab, click the "Add Localization" button
169 // create a new localization for the language you're adding
170 // set the contents of the new localization of the file to the string corresponding to our localization
171 // (i.e. "en-us", "ja", etc. Use the existing ones as a guide.)
172 CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
173 char path[MAX_PATH];
174 if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
175 {
176 LLString lang;
177 if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/
178 {
179 LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
180 if(c)
181 {
182 c->setValue(lang, false);
183 }
184 }
185 }
186 CFRelease(url);
187
188 return true;
189}
190
191void LLAppViewerMacOSX::handleSyncCrashTrace()
192{
193 // do nothing
194}
195
111void LLAppViewerMacOSX::handleCrashReporting() 196void LLAppViewerMacOSX::handleCrashReporting()
112{ 197{
113 // Macintosh 198 // Macintosh