Some minor fixes.

This commit is contained in:
spx 2010-08-06 07:40:43 +00:00
parent 98c1f70f17
commit 2e32b0f5c1
3 changed files with 17 additions and 6 deletions

View File

@ -408,7 +408,8 @@ void CMeterImage::ReadConfig(const WCHAR* section)
m_Path = parser.ReadString(section, L"Path", L""); m_Path = parser.ReadString(section, L"Path", L"");
if (!m_Path.empty()) if (!m_Path.empty())
{ {
if (m_Path[m_Path.length() - 1] != L'\\') WCHAR ch = m_Path[m_Path.length() - 1];
if (ch != L'\\' && ch != L'/')
{ {
m_Path += L"\\"; m_Path += L"\\";
} }

View File

@ -4377,7 +4377,8 @@ std::wstring CMeterWindow::MakePathAbsolute(std::wstring path)
std::wstring root = m_SkinPath + m_SkinName; std::wstring root = m_SkinPath + m_SkinName;
if (root[root.length() - 1] != L'\\') WCHAR ch = root[root.length() - 1];
if (ch != L'\\' && ch != L'/')
{ {
root += L"\\"; root += L"\\";
} }

View File

@ -1368,11 +1368,15 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
m_PluginPath = ConvertToWide(tmpSz); m_PluginPath = ConvertToWide(tmpSz);
} }
if (!m_SkinPath.empty() && m_SkinPath[m_SkinPath.size() - 1] != L'\\') if (!m_SkinPath.empty())
{
WCHAR ch = m_SkinPath[m_SkinPath.size() - 1];
if (ch != L'\\' && ch != L'/')
{ {
m_SkinPath += L"\\"; m_SkinPath += L"\\";
} }
} }
}
DebugLog(L"Path: %s", m_Path.c_str()); DebugLog(L"Path: %s", m_Path.c_str());
DebugLog(L"IniFile: %s", m_IniFile.c_str()); DebugLog(L"IniFile: %s", m_IniFile.c_str());
@ -3106,6 +3110,11 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
} }
HMENU configMenu = CreateConfigMenu(m_ConfigMenu); HMENU configMenu = CreateConfigMenu(m_ConfigMenu);
if (!configMenu)
{
configMenu = CreatePopupMenu();
AppendMenu(configMenu, MF_GRAYED, 0, L"No configs available");
}
if (configMenu) if (configMenu)
{ {
AppendMenu(configMenu, MF_SEPARATOR, 0, NULL); AppendMenu(configMenu, MF_SEPARATOR, 0, NULL);
@ -3655,12 +3664,12 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
std::wstring CRainmeter::ExtractPath(const std::wstring& strFilePath) std::wstring CRainmeter::ExtractPath(const std::wstring& strFilePath)
{ {
size_t pos = strFilePath.rfind(L"\\"); std::wstring::size_type pos = strFilePath.find_last_of(L"\\/");
if (pos != std::wstring::npos) if (pos != std::wstring::npos)
{ {
return strFilePath.substr(0, pos + 1); return strFilePath.substr(0, pos + 1);
} }
return L"."; return L".\\";
} }
void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath) void CRainmeter::ExpandEnvironmentVariables(std::wstring& strPath)