This commit is contained in:
Birunthan Mohanathas 2012-05-20 21:05:15 +03:00
parent 6a520542bc
commit f2318c4a65
3 changed files with 8 additions and 16 deletions

View File

@ -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\\"

View File

@ -449,10 +449,8 @@ private:
std::list<CMeasure*> m_Measures;
std::list<CMeter*> 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;

View File

@ -493,10 +493,7 @@ void CRainmeter::Bang_WriteKeyValue(std::vector<std::wstring>& 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<std::wstring, CMeterWindow*>::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;