mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Moved default skins and themes into ProgramPath\Defaults\
This commit is contained in:
parent
0891ee4b91
commit
96959d62f1
@ -501,6 +501,7 @@ UAC_TryAgain:
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
!macro InstallFiles DIR
|
!macro InstallFiles DIR
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
File "..\..\TestBench\${DIR}\Release\Rainmeter.exe"
|
File "..\..\TestBench\${DIR}\Release\Rainmeter.exe"
|
||||||
File "..\..\TestBench\${DIR}\Release\Rainmeter.dll"
|
File "..\..\TestBench\${DIR}\Release\Rainmeter.dll"
|
||||||
File "..\..\TestBench\${DIR}\Release\SkinInstaller.exe"
|
File "..\..\TestBench\${DIR}\Release\SkinInstaller.exe"
|
||||||
@ -700,6 +701,13 @@ SkipIniMove:
|
|||||||
Delete "$INSTDIR\Rainmeter.chm"
|
Delete "$INSTDIR\Rainmeter.chm"
|
||||||
Delete "$INSTDIR\Default.ini"
|
Delete "$INSTDIR\Default.ini"
|
||||||
|
|
||||||
|
${If} $InstallPortable != 1
|
||||||
|
${AndIfNot} ${FileExists} "$INSTDIR\Defaults"
|
||||||
|
SetOutPath "$INSTDIR\Defaults"
|
||||||
|
Rename "$INSTDIR\Skins" "$INSTDIR\Defaults\Skins"
|
||||||
|
Rename "$INSTDIR\Themes" "$INSTDIR\Defaults\Themes"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
!ifdef INCLUDEFILES
|
!ifdef INCLUDEFILES
|
||||||
${If} $instArc == "x86"
|
${If} $instArc == "x86"
|
||||||
!insertmacro InstallFiles "x32"
|
!insertmacro InstallFiles "x32"
|
||||||
@ -713,12 +721,12 @@ SkipIniMove:
|
|||||||
|
|
||||||
RMDir /r "$INSTDIR\Addons\Rainstaller"
|
RMDir /r "$INSTDIR\Addons\Rainstaller"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\Skins"
|
SetOutPath "$INSTDIR\Defaults\Skins"
|
||||||
RMDir /r "$INSTDIR\Skins\illustro"
|
RMDir /r "$INSTDIR\Skins\illustro"
|
||||||
Delete "$INSTDIR\Skins\*.txt"
|
Delete "$INSTDIR\Skins\*.txt"
|
||||||
File /r "..\Skins\*.*"
|
File /r "..\Skins\*.*"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\Themes"
|
SetOutPath "$INSTDIR\Defaults\Themes"
|
||||||
File /r "..\Themes\*.*"
|
File /r "..\Themes\*.*"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -802,12 +802,6 @@ 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)
|
|
||||||
{
|
|
||||||
CreateDefaultConfigFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set file locations
|
// Set file locations
|
||||||
{
|
{
|
||||||
size_t len = m_IniFile.length();
|
size_t len = m_IniFile.length();
|
||||||
@ -830,10 +824,6 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
CreateDataFile();
|
CreateDataFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read Logging settings beforehand
|
|
||||||
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, iniFile);
|
|
||||||
m_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, iniFile);
|
|
||||||
|
|
||||||
// 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)
|
||||||
@ -878,20 +868,19 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
// Reset log file
|
// Reset log file
|
||||||
CSystem::RemoveFile(m_LogFile);
|
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)
|
if (m_Logging)
|
||||||
{
|
{
|
||||||
StartLogging();
|
StartLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PluginPath = m_AddonPath = m_SkinPath = m_Path;
|
// Get skin folder path
|
||||||
m_PluginPath += L"Plugins\\";
|
|
||||||
m_AddonPath += L"Addons\\";
|
|
||||||
m_SkinPath += L"Skins\\";
|
|
||||||
|
|
||||||
// Read the skin folder from the ini file
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
// Try Rainmeter.ini first
|
||||||
m_SkinPath.assign(buffer, len);
|
m_SkinPath.assign(buffer, len);
|
||||||
ExpandEnvironmentVariables(m_SkinPath);
|
ExpandEnvironmentVariables(m_SkinPath);
|
||||||
|
|
||||||
@ -903,24 +892,20 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bDefaultIniLocation)
|
else if (bDefaultIniLocation &&
|
||||||
|
SUCCEEDED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buffer)))
|
||||||
{
|
{
|
||||||
// If the skin path is not defined in the Rainmeter.ini file use My Documents/Rainmeter/Skins
|
// Use My Documents/Rainmeter/Skins
|
||||||
buffer[0] = L'\0';
|
|
||||||
HRESULT hr = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buffer);
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
// Make the folders if they don't exist yet
|
|
||||||
m_SkinPath = buffer;
|
m_SkinPath = buffer;
|
||||||
m_SkinPath += L"\\Rainmeter";
|
m_SkinPath += L"\\Rainmeter\\";
|
||||||
CreateDirectory(m_SkinPath.c_str(), NULL);
|
CreateDirectory(m_SkinPath.c_str(), NULL);
|
||||||
m_SkinPath += L"\\Skins\\";
|
m_SkinPath += L"Skins\\";
|
||||||
DWORD result = CreateDirectory(m_SkinPath.c_str(), NULL);
|
DWORD result = CreateDirectory(m_SkinPath.c_str(), NULL);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
// The folder was created successfully which means that it wasn't available yet.
|
// Folder just created, so copy default skins there
|
||||||
// Copy the default skin to the Skins folder
|
std::wstring from = GetDefaultSkinPath();
|
||||||
std::wstring from = m_Path + L"Skins\\*.*";
|
from += L"*.*";
|
||||||
CSystem::CopyFiles(from, m_SkinPath);
|
CSystem::CopyFiles(from, m_SkinPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,17 +915,23 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
// Copy themes to %APPDATA%
|
// Copy themes to %APPDATA%
|
||||||
std::wstring from = m_Path + L"Themes\\*.*";
|
std::wstring from = GetDefaultThemePath();
|
||||||
|
from += L"*.*";
|
||||||
CSystem::CopyFiles(from, themesPath);
|
CSystem::CopyFiles(from, themesPath);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log(LOG_WARNING, L"Documents folder not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile);
|
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_SkinPath = m_Path + L"Skins\\";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a default Rainmeter.ini file if needed
|
||||||
|
if (_waccess(iniFile, 0) == -1)
|
||||||
|
{
|
||||||
|
CreateDefaultConfigFile();
|
||||||
|
}
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
@ -1166,10 +1157,6 @@ void CRainmeter::SetNetworkStatisticsTimer()
|
|||||||
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Creates the default Rainmeter.ini file with illustro\System enabled.
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
void CRainmeter::CreateDefaultConfigFile()
|
void CRainmeter::CreateDefaultConfigFile()
|
||||||
{
|
{
|
||||||
size_t pos = m_IniFile.find_last_of(L'\\');
|
size_t pos = m_IniFile.find_last_of(L'\\');
|
||||||
@ -1179,15 +1166,9 @@ void CRainmeter::CreateDefaultConfigFile()
|
|||||||
CreateDirectory(strPath.c_str(), NULL);
|
CreateDirectory(strPath.c_str(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring defaultIni = GetPath() + L"Themes\\illustro default\\Rainmeter.thm";
|
std::wstring defaultIni = GetDefaultThemePath();
|
||||||
if (_waccess(defaultIni.c_str(), 0) == -1)
|
defaultIni += L"illustro default\\Rainmeter.thm";
|
||||||
{
|
|
||||||
WritePrivateProfileString(L"Rainmeter", L"\r\n[illustro\\System]\r\nActive", L"1", m_IniFile.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSystem::CopyFiles(defaultIni, m_IniFile);
|
CSystem::CopyFiles(defaultIni, m_IniFile);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRainmeter::CreateDataFile()
|
void CRainmeter::CreateDataFile()
|
||||||
|
@ -155,9 +155,12 @@ public:
|
|||||||
const std::wstring& GetDataFile() { return m_DataFile; }
|
const std::wstring& GetDataFile() { return m_DataFile; }
|
||||||
const std::wstring& GetLogFile() { return m_LogFile; }
|
const std::wstring& GetLogFile() { return m_LogFile; }
|
||||||
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
||||||
const std::wstring& GetPluginPath() { return m_PluginPath; }
|
|
||||||
const std::wstring& GetAddonPath() { return m_AddonPath; }
|
|
||||||
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); }
|
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); }
|
||||||
|
std::wstring GetPluginPath() { return m_Path + L"Plugins\\"; }
|
||||||
|
std::wstring GetAddonPath() { return m_Path + L"Addons\\"; }
|
||||||
|
|
||||||
|
std::wstring GetDefaultSkinPath() { return m_Path + L"Defaults\\Skins\\"; }
|
||||||
|
std::wstring GetDefaultThemePath() { return m_Path + L"Defaults\\Themes\\"; }
|
||||||
|
|
||||||
const std::wstring& GetDrive() { return m_Drive; }
|
const std::wstring& GetDrive() { return m_Drive; }
|
||||||
|
|
||||||
@ -282,8 +285,6 @@ private:
|
|||||||
std::wstring m_StatsFile;
|
std::wstring m_StatsFile;
|
||||||
std::wstring m_LogFile;
|
std::wstring m_LogFile;
|
||||||
std::wstring m_SkinPath;
|
std::wstring m_SkinPath;
|
||||||
std::wstring m_PluginPath;
|
|
||||||
std::wstring m_AddonPath;
|
|
||||||
|
|
||||||
std::wstring m_Drive;
|
std::wstring m_Drive;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user