summaryrefslogtreecommitdiff
path: root/indra/llcommon/llliveappconfig.cpp
blob: 8bcaeb898f1e9840c95e86d200987478d225811c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/** 
 * @file llliveappconfig.cpp
 * @brief Configuration information for an LLApp that overrides indra.xml
 *
 * Copyright (c) 2003-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

#include "linden_common.h"

#include "llliveappconfig.h"

#include "llapp.h"
#include "llsd.h"
#include "llsdserialize.h"

LLLiveAppConfig::LLLiveAppConfig(LLApp* app, const std::string& filename, F32 refresh_period)
:	LLLiveFile(filename, refresh_period),
	mApp(app)
{ }


LLLiveAppConfig::~LLLiveAppConfig()
{ }

// virtual 
void LLLiveAppConfig::loadFile()
{
	llinfos << "LLLiveAppConfig::loadFile(): reading from "
		<< filename() << llendl;
    llifstream file(filename().c_str());
	LLSD config;
    if (file.is_open())
    {
        LLSDSerialize::fromXML(config, file);
		if(!config.isMap())
		{
			llinfos << "LLDataserverConfig::loadFile(): not an map!"
				<< " Ignoring the data." << llendl;
			return;
		}
		file.close();
    }
	mApp->setOptionData(
		LLApp::PRIORITY_SPECIFIC_CONFIGURATION, config);
}