diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index f836f9df..423cba6e 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -137,7 +137,6 @@ CMeterWindow::CMeterWindow(const std::wstring& config, const std::wstring& iniFi m_Refreshing(false), m_Hidden(false), m_ResizeWindow(RESIZEMODE_NONE), - m_ResourcesFolder(false), m_UpdateCounter(), m_MouseMoveCounter(), m_FontCollection(), @@ -1947,9 +1946,7 @@ bool CMeterWindow::ReadSkin() { WCHAR buffer[128]; - std::wstring iniFile = Rainmeter->GetSkinPath() + m_SkinName; - iniFile += L'\\'; - iniFile += m_SkinIniFile; + std::wstring iniFile = GetSkinFilePath(); // Verify whether the file exists if (_waccess(iniFile.c_str(), 0) == -1) @@ -1960,7 +1957,7 @@ bool CMeterWindow::ReadSkin() } std::wstring resourcePath = GetSkinResourcesPath(); - m_ResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); + bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); m_Parser.Initialize(iniFile, this, NULL, &resourcePath); @@ -2074,7 +2071,7 @@ bool CMeterWindow::ReadSkin() } // Load fonts in Resources folder - if (m_ResourcesFolder) + if (hasResourcesFolder) { WIN32_FIND_DATA fd; resourcePath += L"Fonts\\*"; @@ -4681,7 +4678,7 @@ void CMeterWindow::MakePathAbsolute(std::wstring& path) { std::wstring absolute; - if (m_ResourcesFolder && (path[0] == L'@' && path[1] == L'\\')) // path[1] == L'\0' if path.size() == 1 + if (path[0] == L'@' && path[1] == L'\\') // path[1] == L'\0' if path.size() == 1 { const std::wstring::size_type resourcesLen = 13; // Count of "\\@Resources\\" diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 2cae67ab..a0755bca 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -449,10 +449,8 @@ private: std::list m_Measures; std::list m_Meters; - const std::wstring m_SkinName; - const std::wstring m_SkinIniFile; - - bool m_ResourcesFolder; + const std::wstring& m_SkinName; + const std::wstring& m_SkinIniFile; int m_UpdateCounter; UINT m_MouseMoveCounter; diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 4dff10ae..edfdd8ff 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -493,10 +493,7 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo if (!meterWindow) return; // Add the config filepath to the args - std::wstring path = m_SkinPath + meterWindow->GetSkinName(); - path += L'\\'; - path += meterWindow->GetSkinIniFile(); - args.push_back(std::move(path)); + args.push_back(meterWindow->GetSkinFilePath()); } if (args.size() > 3) @@ -1250,7 +1247,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex) std::map::const_iterator iter = m_MeterWindows.find(skinConfig); if (iter != m_MeterWindows.end()) { - if (((*iter).second)->GetSkinIniFile() == skinIniFile) + if (&((*iter).second)->GetSkinIniFile() == &skinIniFile) { LogWithArgs(LOG_WARNING, L"!ActivateConfig: \"%s\" already active", skinConfig.c_str()); return;