bool FirefoxPreferencesFile::_getProfileDirectoryFromProfilesIni(wstring file, wstring &profileLocation)
{
	wifstream reader;
	wstring line;
	const int pathLen = wcslen(PATHKEY);

	reader.open(file.c_str());

	if (!reader.is_open())
	{
		g_log.Log(L"FirefoxPreferencesFile::_getProfileDirectoryFromProfilesIni. Cannot open file %s", (wchar_t *) file.c_str());
		return false;
	}

	while(!(getline(reader, line)).eof())
	{
		if (_wcsnicmp(line.c_str(), PATHKEY, pathLen) != 0)
			continue;

		profileLocation = _getProfileRootDir() + (wchar_t *)&line[pathLen];
		return true;
	}

	g_log.Log(L"FirefoxPreferencesFile::_getProfileDirectoryFromProfilesIni. Path key not found");
	return false;
}
bool FirefoxAction::_getProfileLocationFromProfilesIni(wstring file, wstring &profileLocation)
{
	wifstream reader;
	wstring line;
	const int pathLen = wcslen(PATHKEY);

	reader.open(file.c_str());

	if (!reader.is_open())	
		return false;

	while(!(getline(reader, line)).eof())
	{
		if (_wcsnicmp(line.c_str(), PATHKEY, pathLen) != 0)
			continue;

		_getProfileRootDir(profileLocation);
		profileLocation += (wchar_t *)&line[pathLen];
		return true;
	}

	return false;
}
void FirefoxAction::_getProfilesIniLocation(wstring &location)
{	
	_getProfileRootDir(location);
	location += L"profiles.ini";
}
void FirefoxPreferencesFile::_getProfilesIniLocation(wstring &location)
{	
	location = _getProfileRootDir();
	location += L"profiles.ini";
}