1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "common/config-manager.h"
24 #include "common/fs.h"
25 
26 #include "testbed/config-params.h"
27 
28 namespace Common {
29 DECLARE_SINGLETON(Testbed::ConfigParams);
30 }
31 
32 namespace Testbed {
33 
ConfigParams()34 ConfigParams::ConfigParams() {
35 	_logDirectory = "";
36 	_logFilename = "";
37 	_ws = 0;
38 	_displayFont = Graphics::FontManager::kGUIFont;
39 	_isInteractive = true;
40 	_isGameDataFound = true;
41 	_rerunTests = false;
42 
43 	_testbedConfMan = 0;
44 }
45 
initLogging(const char * dirname,const char * filename,bool enable)46 void ConfigParams::initLogging(const char *dirname, const char *filename, bool enable) {
47 	setLogDirectory(dirname);
48 	setLogFilename(filename);
49 	if (enable) {
50 		_ws = Common::FSNode(_logDirectory).getChild(_logFilename).createWriteStream();
51 	} else {
52 		_ws = 0;
53 	}
54 }
55 
initLogging(bool enable)56 void ConfigParams::initLogging(bool enable) {
57 	// Default Log Directory is game-data directory and filename is 'testbed.log'.
58 	initLogging(ConfMan.get("path").c_str(), "testbed.log", enable);
59 }
60 
isRerunRequired()61 bool ConfigParams::isRerunRequired() {
62 	if (_rerunTests) {
63 		_rerunTests = false;
64 		return true;
65 	}
66 	return false;
67 }
68 
deleteWriteStream()69 void ConfigParams::deleteWriteStream() {
70 	if (_ws) {
71 		delete _ws;
72 	}
73 }
74 
75 } // End of namespace Testbed
76