From fe22cfdf3dce005c604679ee9fffe584a260b4b2 Mon Sep 17 00:00:00 2001 From: spx Date: Sat, 11 Dec 2010 05:27:01 +0000 Subject: [PATCH] Quick fix for http://rainmeter.net/forum/viewtopic.php?f=5&t=4059&p=39475#p39461 --- Library/ConfigParser.cpp | 8 +++++++- Library/ConfigParser.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index bb988e71..8ec7fd7e 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -672,12 +672,18 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT return result; } -bool CConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key) +bool CConfigParser::IsKeyDefined(LPCTSTR section, LPCTSTR key) { ReadString(section, key, L"", false); return !m_LastDefaultUsed; } +bool CConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key) +{ + const std::wstring& result = ReadString(section, key, L"", false); + return (!m_LastDefaultUsed && !result.empty()); +} + void CConfigParser::AddMeasure(CMeasure* pMeasure) { if (pMeasure) diff --git a/Library/ConfigParser.h b/Library/ConfigParser.h index 82cecc2f..9335a1ec 100644 --- a/Library/ConfigParser.h +++ b/Library/ConfigParser.h @@ -52,6 +52,7 @@ public: void ResetMonitorVariables(CMeterWindow* meterWindow = NULL); const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true); + bool IsKeyDefined(LPCTSTR section, LPCTSTR key); bool IsValueDefined(LPCTSTR section, LPCTSTR key); double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue); double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue);