From 4647c44d928041c49ab74a4a9cb6e4145e5d53a8 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Tue, 19 Jun 2012 14:31:59 +0300 Subject: [PATCH] Fixed missing SkinPath= during first launch --- Library/Rainmeter.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 7a5ae4a8..3d565381 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -799,6 +799,12 @@ int CRainmeter::Initialize(LPCWSTR iniPath) const WCHAR* iniFile = m_IniFile.c_str(); + // Create a default Rainmeter.ini file if needed + if (_waccess(iniFile, 0) == -1) + { + CreateOptionsFile(); + } + // Set file locations { m_SettingsPath = ExtractPath(m_IniFile); @@ -823,6 +829,17 @@ int CRainmeter::Initialize(LPCWSTR iniPath) 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 std::wstring resource = m_Path + L"Languages\\"; 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 size_t len = GetPrivateProfileString(L"Rainmeter", L"SkinPath", L"", buffer, MAX_LINE_LENGTH, iniFile); if (len > 0 && @@ -905,12 +911,6 @@ int CRainmeter::Initialize(LPCWSTR iniPath) 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 CreateComponentFolders(bDefaultIniLocation);