This commit is contained in:
Birunthan Mohanathas 2012-05-24 14:15:46 +03:00
parent 3ac5aea85a
commit 1d61725057

View File

@ -83,26 +83,29 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow) void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow)
{ {
SetBuiltInVariable(L"PROGRAMPATH", Rainmeter->GetPath()); auto insertVariable = [&](const WCHAR* name, std::wstring value)
SetBuiltInVariable(L"PROGRAMDRIVE", Rainmeter->GetDrive()); {
SetBuiltInVariable(L"SETTINGSPATH", Rainmeter->GetSettingsPath()); return m_BuiltInVariables.insert(std::make_pair(name, value));
SetBuiltInVariable(L"SKINSPATH", Rainmeter->GetSkinPath()); };
SetBuiltInVariable(L"PLUGINSPATH", Rainmeter->GetPluginPath());
SetBuiltInVariable(L"CURRENTPATH", CRainmeter::ExtractPath(filename)); insertVariable(L"PROGRAMPATH", Rainmeter->GetPath());
SetBuiltInVariable(L"ADDONSPATH", Rainmeter->GetAddonPath()); insertVariable(L"PROGRAMDRIVE", Rainmeter->GetDrive());
insertVariable(L"SETTINGSPATH", Rainmeter->GetSettingsPath());
insertVariable(L"SKINSPATH", Rainmeter->GetSkinPath());
insertVariable(L"PLUGINSPATH", Rainmeter->GetPluginPath());
insertVariable(L"CURRENTPATH", CRainmeter::ExtractPath(filename));
insertVariable(L"ADDONSPATH", Rainmeter->GetAddonPath());
if (meterWindow) if (meterWindow)
{ {
SetBuiltInVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile()); insertVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile());
SetBuiltInVariable(L"CURRENTCONFIG", meterWindow->GetSkinName()); insertVariable(L"CURRENTCONFIG", meterWindow->GetSkinName());
SetBuiltInVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath()); insertVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath());
} }
SetBuiltInVariable(L"CRLF", L"\n"); insertVariable(L"CRLF", L"\n");
const std::wstring CURRENTSECTION = L"CURRENTSECTION"; m_CurrentSection = &(insertVariable(L"CURRENTSECTION", L"").first->second); // shortcut
SetBuiltInVariable(CURRENTSECTION, L"");
m_CurrentSection = &((*m_BuiltInVariables.find(CURRENTSECTION)).second); // shortcut
if (resourcePath) if (resourcePath)
{ {