<commit_before>/*
 * This file is part of ServerManager package
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 */

#include <cstdlib>
#include <fstream>
#include <sstream>
#include <iostream>
#include "./ConfigParser.h"
#include "./Configuration.h"

using namespace ServerManager;
using namespace std;

ConfigParser::ConfigParser()
{
	string path = getenv("HOME");
	path.append("/.server-manager");
	this->configFile = path;
}

Configuration ConfigParser::getConfiguration()
{
	Configuration cfg;
	ifstream file(this->configFile.c_str());
	string line;
	while(getline(file, line)) {
		istringstream line_string(line);
		string key;
		if (getline(line_string, key, '=')) {
			string value;
			if (getline(line_string, value)) {
				if (key.compare("root") == 0) {
					cfg.root = value;
				} else if (key.compare("ext") == 0) {
					cfg.ext = value;
				} else if (key.compare("htdocs") == 0) {
					cfg.htdocs = value;
				} else if (key.compare("nginx") == 0) {
					cfg.nginx = value;
				} else if (key.compare("hosts") == 0) {
					cfg.hosts = value;
				} else {
					// ERROR
				}
			}
		}
	}

	return cfg;
}<commit_msg>Fixed error<commit_after>/*
 * This file is part of ServerManager package
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 */

#include <cstdlib>
#include <fstream>
#include <sstream>
#include <iostream>
#include "./ConfigParser.h"
#include "./Configuration.h"

using namespace ServerManager;
using namespace std;

ConfigParser::ConfigParser()
{
	string path = getenv("HOME");
	path.append("/.server-manager");
	this->configFile = path;
}

Configuration ConfigParser::getConfiguration()
{
	Configuration cfg;
	ifstream file(this->configFile.c_str());
	string line;
	while(getline(file, line)) {
		istringstream line_string(line);
		string key;
		if (getline(line_string, key, '=')) {
			string value;
			if (getline(line_string, value)) {
				if (key.compare("root") == 0) {
					cfg.root = value;
				} else if (key.compare("ext") == 0) {
					cfg.ext = value;
				} else if (key.compare("htdocs") == 0) {
					cfg.htdocs = value;
				} else if (key.compare("nginx") == 0) {
					cfg.nginx = value;
				} else if (key.compare("hosts") == 0) {
					cfg.hosts = value;
				} else {
					throw "Unsupported option";
				}
			}
		}
	}

	return cfg;
}
{'fraction_non_alphanumeric': 0.1571371451419432, 'fraction_numerical': 0.003998400639744102, 'mean_word_length': 3.5081081081081082, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '954357', 'n_tokens_mistral': 962, 'n_tokens_neox': 833, 'n_words': 223}