diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index feda7293..f2688414 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -2149,15 +2149,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath) } // Create meter windows for active configs - std::multimap::const_iterator iter = m_ConfigOrders.begin(); - for ( ; iter != m_ConfigOrders.end(); ++iter) - { - const CONFIG& config = m_ConfigStrings[(*iter).second]; - if (config.active > 0 && config.active <= (int)config.iniFiles.size()) - { - ActivateConfig((*iter).second, config.active - 1); - } - } + ActivateActiveConfigs(); return Result; // Alles OK } @@ -2195,6 +2187,19 @@ void CRainmeter::ReloadSettings() ReadGeneralSettings(m_IniFile); } +void CRainmeter::ActivateActiveConfigs() +{ + std::multimap::const_iterator iter = m_ConfigOrders.begin(); + for ( ; iter != m_ConfigOrders.end(); ++iter) + { + const CONFIG& config = m_ConfigStrings[(*iter).second]; + if (config.active > 0 && config.active <= (int)config.iniFiles.size()) + { + ActivateConfig((*iter).second, config.active - 1); + } + } +} + void CRainmeter::ActivateConfig(int configIndex, int iniIndex) { if (configIndex >= 0 && configIndex < (int)m_ConfigStrings.size()) @@ -3580,15 +3585,7 @@ void CRainmeter::LoadTheme(const std::wstring& name) ReloadSettings(); // Create meter windows for active configs - std::multimap::const_iterator iter = m_ConfigOrders.begin(); - for ( ; iter != m_ConfigOrders.end(); ++iter) - { - const CONFIG& config = m_ConfigStrings[(*iter).second]; - if (config.active > 0 && config.active <= (int)config.iniFiles.size()) - { - ActivateConfig((*iter).second, config.active - 1); - } - } + ActivateActiveConfigs(); } void CRainmeter::PreserveSetting(const std::wstring& from, LPCTSTR key, bool replace) diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 13959627..19739a9f 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -268,6 +268,7 @@ public: friend class CDialogManage; private: + void ActivateActiveConfigs(); void CreateMeterWindow(const std::wstring& path, const std::wstring& config, const std::wstring& iniFile); bool DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater); void WriteActive(const std::wstring& config, int iniIndex); diff --git a/Library/System.cpp b/Library/System.cpp index 812f1093..33e68891 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -1141,10 +1141,8 @@ bool CSystem::CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, std::wstring tmpFrom(strFrom), tmpTo(strTo); // The strings must end with double nul - tmpFrom.append(L"0"); - tmpFrom[tmpFrom.size() - 1] = L'\0'; - tmpTo.append(L"0"); - tmpTo[tmpTo.size() - 1] = L'\0'; + tmpFrom.append(1, L'\0'); + tmpTo.append(1, L'\0'); SHFILEOPSTRUCT fo = {0}; fo.wFunc = bMove ? FO_MOVE : FO_COPY; @@ -1190,8 +1188,7 @@ bool CSystem::RemoveFolder(const std::wstring& strFolder) std::wstring tmpFolder(strFolder); // The strings must end with double nul - tmpFolder.append(L"0"); - tmpFolder[tmpFolder.size() - 1] = L'\0'; + tmpFolder.append(1, L'\0'); SHFILEOPSTRUCT fo = {0}; fo.wFunc = FO_DELETE;