Fixed: SkinPath is read from Rainmeter.ini in portable installations.

This commit is contained in:
Birunthan Mohanathas 2011-05-01 13:29:09 +00:00
parent 3d9fc72776
commit 710bce5ca4

View File

@ -1726,6 +1726,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
if (!c_DummyLitestep) InitalizeLitestep(); if (!c_DummyLitestep) InitalizeLitestep();
bool bDefaultIniLocation = false; bool bDefaultIniLocation = false;
bool bPortableInstallation = false;
if (c_CmdLine.empty()) if (c_CmdLine.empty())
{ {
@ -1745,6 +1746,10 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
CreateDefaultConfigFile(m_IniFile); CreateDefaultConfigFile(m_IniFile);
} }
} }
else
{
bPortableInstallation = true;
}
} }
else else
{ {
@ -1819,6 +1824,8 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
m_SkinPath += L"Skins\\"; m_SkinPath += L"Skins\\";
// Read the skin folder from the ini file // Read the skin folder from the ini file
if (!bPortableInstallation)
{
tmpSzPath[0] = L'\0'; tmpSzPath[0] = L'\0';
if (GetPrivateProfileString(L"Rainmeter", L"SkinPath", L"", tmpSzPath, MAX_LINE_LENGTH, m_IniFile.c_str()) > 0) if (GetPrivateProfileString(L"Rainmeter", L"SkinPath", L"", tmpSzPath, MAX_LINE_LENGTH, m_IniFile.c_str()) > 0)
{ {
@ -1871,6 +1878,7 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
Log(LOG_WARNING, L"Unable to get the My Documents location."); Log(LOG_WARNING, L"Unable to get the My Documents location.");
} }
} }
}
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str()); WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
delete [] tmpSzPath; delete [] tmpSzPath;