aboutsummaryrefslogtreecommitdiff
path: root/lib/base/econfig.cpp
blob: 3d51255b5c5e025a9809925b0a8475a7f05b4df8 (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
#include <lib/base/eerror.h>
#include <lib/base/econfig.h>
#include <lib/base/init.h>
#include <lib/base/init_num.h>
#include <sys/stat.h>

eConfig *eConfig::instance;

eConfig::eConfig()
{
	if (!instance)
		instance=this;

	setName(CONFIGDIR "/enigma/registry");
	int e=open();
	if (e == NC_ERR_CORRUPT)
	{
		eWarning("CORRUTPED REGISTRY!");
		::remove(CONFIGDIR "/enigma/registry");
	}
	if (e)
	{
		if (createNew())
		{
			mkdir(CONFIGDIR "/enigma", 0777);
			if (createNew())
				eFatal("error while opening/creating registry - create " CONFIGDIR "/enigma");
		}
		if (open())
			eFatal("still can't open configfile");
	}
	locked=1;
	ppin=0;
	getKey("/elitedvb/pins/parentallock", ppin );
}

eConfig::~eConfig()
{
	if (instance==this)
		instance=0;
}

eAutoInitP0<eConfig> init_eRCConfig(eAutoInitNumbers::configuration, "Configuration");