Fixed missing SkinPath= during first launch

This commit is contained in:
Birunthan Mohanathas 2012-06-19 14:31:59 +03:00
parent 0ce52f744a
commit 4647c44d92

View File

@ -799,6 +799,12 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
const WCHAR* iniFile = m_IniFile.c_str(); const WCHAR* iniFile = m_IniFile.c_str();
// Create a default Rainmeter.ini file if needed
if (_waccess(iniFile, 0) == -1)
{
CreateOptionsFile();
}
// Set file locations // Set file locations
{ {
m_SettingsPath = ExtractPath(m_IniFile); m_SettingsPath = ExtractPath(m_IniFile);
@ -823,6 +829,17 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
CreateDataFile(); CreateDataFile();
} }
// Reset log file
CSystem::RemoveFile(m_LogFile);
m_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, iniFile);
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, iniFile);
if (m_Logging)
{
StartLogging();
}
// Determine the language resource to load // Determine the language resource to load
std::wstring resource = m_Path + L"Languages\\"; std::wstring resource = m_Path + L"Languages\\";
if (GetPrivateProfileString(L"Rainmeter", L"Language", L"", buffer, MAX_LINE_LENGTH, iniFile) == 0) if (GetPrivateProfileString(L"Rainmeter", L"Language", L"", buffer, MAX_LINE_LENGTH, iniFile) == 0)
@ -864,17 +881,6 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
} }
} }
// Reset log file
CSystem::RemoveFile(m_LogFile);
m_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, iniFile);
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, iniFile);
if (m_Logging)
{
StartLogging();
}
// Get skin folder path // Get skin folder path
size_t len = GetPrivateProfileString(L"Rainmeter", L"SkinPath", L"", buffer, MAX_LINE_LENGTH, iniFile); size_t len = GetPrivateProfileString(L"Rainmeter", L"SkinPath", L"", buffer, MAX_LINE_LENGTH, iniFile);
if (len > 0 && if (len > 0 &&
@ -905,12 +911,6 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
m_SkinPath = m_Path + L"Skins\\"; m_SkinPath = m_Path + L"Skins\\";
} }
// Create a default Rainmeter.ini file if needed
if (_waccess(iniFile, 0) == -1)
{
CreateOptionsFile();
}
// Create user skins, themes, addons, and plugins folders if needed // Create user skins, themes, addons, and plugins folders if needed
CreateComponentFolders(bDefaultIniLocation); CreateComponentFolders(bDefaultIniLocation);