diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/viewerversion.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/linden/indra/newview/viewerversion.cpp b/linden/indra/newview/viewerversion.cpp new file mode 100644 index 0000000..95c8f76 --- /dev/null +++ b/linden/indra/newview/viewerversion.cpp | |||
@@ -0,0 +1,89 @@ | |||
1 | /** | ||
2 | * @file viewerversion.cpp | ||
3 | * @brief set the viewer version in xml | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2009&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2010, McCabe Maxsted | ||
8 | * | ||
9 | * Imprudence Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided to you | ||
11 | * under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in | ||
13 | * this distribution, or online at | ||
14 | * http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | * $/LicenseInfo$ | ||
29 | */ | ||
30 | |||
31 | #include "llviewerprecompiledheaders.h" | ||
32 | |||
33 | #include "lldir.h" | ||
34 | #include "llxmltree.h" | ||
35 | #include "viewerversion.h" | ||
36 | |||
37 | |||
38 | S32 ViewerVersion::sVersionMajor = 0; | ||
39 | S32 ViewerVersion::sVersionMinor = 0; | ||
40 | S32 ViewerVersion::sVersionPatch = 0; | ||
41 | std::string ViewerVersion::sVersionTest = ""; | ||
42 | |||
43 | const std::string ViewerVersion::sViewerName = "Imprudence"; | ||
44 | |||
45 | ViewerVersion::ViewerVersion() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | bool ViewerVersion::initViewerVersion() | ||
50 | { | ||
51 | std::string file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "viewerversion.xml"); | ||
52 | |||
53 | if (!gDirUtilp->fileExists(file_path)) | ||
54 | { | ||
55 | llwarns << "Unable to find viewerversion.xml in app_settings folder" << llendl; | ||
56 | return false; | ||
57 | } | ||
58 | else | ||
59 | { | ||
60 | LLXMLNodePtr root; | ||
61 | |||
62 | if (!LLXMLNode::parseFile(file_path, root, NULL)) | ||
63 | { | ||
64 | llwarns << "Unable to parse version file: " << file_path << llendl; | ||
65 | return false; | ||
66 | } | ||
67 | |||
68 | if (root.isNull()) // shouldn't ever happen | ||
69 | { | ||
70 | llwarns << "Error while trying to read viewerversion.xml" << llendl; | ||
71 | return false; | ||
72 | } | ||
73 | |||
74 | LLXMLNodePtr child_nodep = root->getFirstChild(); | ||
75 | while (child_nodep.notNull()) | ||
76 | { | ||
77 | child_nodep->getAttributeS32("version_major", sVersionMajor); | ||
78 | child_nodep->getAttributeS32("version_minor", sVersionMinor); | ||
79 | child_nodep->getAttributeS32("version_patch", sVersionPatch); | ||
80 | child_nodep->getAttributeString("version_test", sVersionTest); | ||
81 | |||
82 | child_nodep = child_nodep->getNextSibling(); | ||
83 | } | ||
84 | |||
85 | llinfos << "Version set to: " << sVersionMajor << "." << sVersionMinor << "." << sVersionPatch << " " << sVersionTest << llendl; | ||
86 | |||
87 | return true; | ||
88 | } | ||
89 | } | ||