mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Moved addons and non-default plugins to #SETTINGSPATH#
This commit is contained in:
parent
1b4d45e81c
commit
87817bc050
@ -697,15 +697,27 @@ SkipIniMove:
|
|||||||
Delete "$0\SkinInstaller.exe"
|
Delete "$0\SkinInstaller.exe"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
; Cleanup old stuff
|
||||||
Delete "$INSTDIR\Rainmeter.exe.config"
|
Delete "$INSTDIR\Rainmeter.exe.config"
|
||||||
Delete "$INSTDIR\Rainmeter.chm"
|
Delete "$INSTDIR\Rainmeter.chm"
|
||||||
Delete "$INSTDIR\Default.ini"
|
Delete "$INSTDIR\Default.ini"
|
||||||
|
RMDir /r "$INSTDIR\Addons\Rainstaller"
|
||||||
|
RMDir /r "$INSTDIR\Addons\RainBackup"
|
||||||
|
|
||||||
${If} $InstallPortable != 1
|
${If} $InstallPortable != 1
|
||||||
${AndIfNot} ${FileExists} "$INSTDIR\Defaults"
|
CreateDirectory "$INSTDIR\Defaults"
|
||||||
SetOutPath "$INSTDIR\Defaults"
|
|
||||||
Rename "$INSTDIR\Skins" "$INSTDIR\Defaults\Skins"
|
Rename "$INSTDIR\Skins" "$INSTDIR\Defaults\Skins"
|
||||||
Rename "$INSTDIR\Themes" "$INSTDIR\Defaults\Themes"
|
Rename "$INSTDIR\Themes" "$INSTDIR\Defaults\Themes"
|
||||||
|
|
||||||
|
${If} ${FileExists} "$INSTDIR\Addons\Backup"
|
||||||
|
${OrIf} ${FileExists} "$INSTDIR\Plugins\Backup"
|
||||||
|
CreateDirectory "$INSTDIR\Defaults\Backup"
|
||||||
|
Rename "$INSTDIR\Addons\Backup" "$INSTDIR\Defaults\Backup\Addons"
|
||||||
|
Rename "$INSTDIR\Plugins\Backup" "$INSTDIR\Defaults\Backup\Plugins"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Rename "$INSTDIR\Addons" "$INSTDIR\Defaults\Addons"
|
||||||
|
${Locate} "$INSTDIR\Plugins" "/L=F /M=*.dll /G=0" "MoveNonDefaultPlugins"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
!ifdef INCLUDEFILES
|
!ifdef INCLUDEFILES
|
||||||
@ -719,8 +731,6 @@ SkipIniMove:
|
|||||||
SetOutPath "$INSTDIR\Languages"
|
SetOutPath "$INSTDIR\Languages"
|
||||||
File "..\..\TestBench\x32\Release\Languages\*.*"
|
File "..\..\TestBench\x32\Release\Languages\*.*"
|
||||||
|
|
||||||
RMDir /r "$INSTDIR\Addons\Rainstaller"
|
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\Defaults\Skins"
|
SetOutPath "$INSTDIR\Defaults\Skins"
|
||||||
RMDir /r "$INSTDIR\Skins\illustro"
|
RMDir /r "$INSTDIR\Skins\illustro"
|
||||||
Delete "$INSTDIR\Skins\*.txt"
|
Delete "$INSTDIR\Skins\*.txt"
|
||||||
@ -805,6 +815,35 @@ Function CopyIniToAppData
|
|||||||
${EndIf}
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
Function MoveNonDefaultPlugins
|
||||||
|
${If} $R7 != "AdvancedCPU.dll"
|
||||||
|
${AndIf} $R7 != "CoreTemp.dll"
|
||||||
|
${AndIf} $R7 != "FolderInfo.dll"
|
||||||
|
${AndIf} $R7 != "InputText.dll"
|
||||||
|
${AndIf} $R7 != "iTunesPlugin.dll"
|
||||||
|
${AndIf} $R7 != "MediaKey.dll"
|
||||||
|
${AndIf} $R7 != "NowPlaying.dll"
|
||||||
|
${AndIf} $R7 != "PerfMon.dll"
|
||||||
|
${AndIf} $R7 != "PingPlugin.dll"
|
||||||
|
${AndIf} $R7 != "PowerPlugin.dll"
|
||||||
|
${AndIf} $R7 != "Process.dll"
|
||||||
|
${AndIf} $R7 != "QuotePlugin.dll"
|
||||||
|
${AndIf} $R7 != "RecycleManager.dll"
|
||||||
|
${AndIf} $R7 != "ResMon.dll"
|
||||||
|
${AndIf} $R7 != "SpeedFanPlugin.dll"
|
||||||
|
${AndIf} $R7 != "SysInfo.dll"
|
||||||
|
${AndIf} $R7 != "VirtualDesktops.dll"
|
||||||
|
${AndIf} $R7 != "WebParser.dll"
|
||||||
|
${AndIf} $R7 != "WifiStatus.dll"
|
||||||
|
${AndIf} $R7 != "Win7AudioPlugin.dll"
|
||||||
|
${AndIf} $R7 != "WindowMessagePlugin.dll"
|
||||||
|
CreateDirectory "$INSTDIR\Defaults\Plugins"
|
||||||
|
Rename "$R9" "$INSTDIR\Defaults\Plugins\$R7"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
Push $0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function RemoveStartMenuShortcuts
|
Function RemoveStartMenuShortcuts
|
||||||
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
|
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
@ -901,35 +940,20 @@ Section Uninstall
|
|||||||
Sleep 500
|
Sleep 500
|
||||||
${Next}
|
${Next}
|
||||||
|
|
||||||
RMDir /r "$TEMP\Rainmeter-Cache"
|
RMDir /r "$INSTDIR\Defaults"
|
||||||
RMDir /r "$INSTDIR\Skins\Gnometer"
|
|
||||||
RMDir /r "$INSTDIR\Skins\Tranquil"
|
|
||||||
RMDir /r "$INSTDIR\Skins\Enigma"
|
|
||||||
RMDir /r "$INSTDIR\Skins\Arcs"
|
|
||||||
RMDir /r "$INSTDIR\Skins\illustro"
|
|
||||||
Delete "$INSTDIR\Skins\*.txt"
|
|
||||||
RMDir "$INSTDIR\Skins"
|
|
||||||
|
|
||||||
RMDir /r "$INSTDIR\Addons\RainThemes"
|
|
||||||
RMDir /r "$INSTDIR\Addons\RainBrowser"
|
|
||||||
RMDir /r "$INSTDIR\Addons\RainBackup"
|
|
||||||
RMDir /r "$INSTDIR\Addons\Rainstaller"
|
|
||||||
RMDir "$INSTDIR\Addons"
|
|
||||||
Delete "$INSTDIR\Plugins\*.*"
|
|
||||||
RMDir "$INSTDIR\Plugins"
|
|
||||||
RMDir /r "$INSTDIR\Languages"
|
RMDir /r "$INSTDIR\Languages"
|
||||||
RMDir /r "$INSTDIR\Themes"
|
RMDir /r "$INSTDIR\Plugins"
|
||||||
Delete "$INSTDIR\*.*"
|
Delete "$INSTDIR\Rainmeter.dll"
|
||||||
|
Delete "$INSTDIR\Rainmeter.exe"
|
||||||
|
Delete "$INSTDIR\SkinInstaller.exe"
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
${If} $un.DeleteAll == 1
|
${If} $un.DeleteAll == 1
|
||||||
RMDir /r "$INSTDIR\Skins"
|
RMDir /r "$INSTDIR\Skins"
|
||||||
RMDir /r "$INSTDIR\Addons"
|
RMDir /r "$INSTDIR\Addons"
|
||||||
RMDir /r "$INSTDIR\Plugins"
|
|
||||||
RMDir /r "$INSTDIR\Fonts"
|
RMDir /r "$INSTDIR\Fonts"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
RMDir "$INSTDIR"
|
|
||||||
|
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
RMDir /r "$APPDATA\Rainstaller"
|
RMDir /r "$APPDATA\Rainstaller"
|
||||||
|
|
||||||
|
@ -937,111 +937,112 @@ void CDialogAbout::CTabPlugins::Initialize()
|
|||||||
vitem.iItem = 0;
|
vitem.iItem = 0;
|
||||||
vitem.iSubItem = 0;
|
vitem.iSubItem = 0;
|
||||||
|
|
||||||
// Scan for plugins
|
auto findPlugins = [&](const std::wstring& path)
|
||||||
WIN32_FIND_DATA fileData; // Data structure describes the file found
|
|
||||||
HANDLE hSearch; // Search handle returned by FindFirstFile
|
|
||||||
|
|
||||||
std::wstring files = Rainmeter->GetPluginPath() + L"*.dll";
|
|
||||||
|
|
||||||
// Start searching for .ini files in the given directory.
|
|
||||||
hSearch = FindFirstFile(files.c_str(), &fileData);
|
|
||||||
int index = 0;
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
if (hSearch == INVALID_HANDLE_VALUE) break; // No more files found
|
std::wstring filter = path + L"*.dll";
|
||||||
|
|
||||||
// Try to get the version and author
|
WIN32_FIND_DATA fd;
|
||||||
std::wstring tmpSz = Rainmeter->GetPluginPath() + fileData.cFileName;
|
HANDLE hSearch = FindFirstFile(filter.c_str(), &fd);
|
||||||
const WCHAR* path = tmpSz.c_str();
|
int index = 0;
|
||||||
|
do
|
||||||
vitem.iItem = index;
|
|
||||||
vitem.pszText = fileData.cFileName;
|
|
||||||
|
|
||||||
// Try to get version and author from file resources first
|
|
||||||
DWORD handle;
|
|
||||||
DWORD versionSize = GetFileVersionInfoSize(path, &handle);
|
|
||||||
if (versionSize)
|
|
||||||
{
|
{
|
||||||
bool found = false;
|
if (hSearch == INVALID_HANDLE_VALUE) break; // No more files found
|
||||||
void* data = new BYTE[versionSize];
|
|
||||||
if (GetFileVersionInfo(path, 0, versionSize, data))
|
// Try to get the version and author
|
||||||
|
std::wstring tmpSz = path + fd.cFileName;
|
||||||
|
const WCHAR* path = tmpSz.c_str();
|
||||||
|
|
||||||
|
vitem.iItem = index;
|
||||||
|
vitem.pszText = fd.cFileName;
|
||||||
|
|
||||||
|
// Try to get version and author from file resources first
|
||||||
|
DWORD handle;
|
||||||
|
DWORD versionSize = GetFileVersionInfoSize(path, &handle);
|
||||||
|
if (versionSize)
|
||||||
{
|
{
|
||||||
UINT len;
|
bool found = false;
|
||||||
struct LANGCODEPAGE
|
void* data = new BYTE[versionSize];
|
||||||
|
if (GetFileVersionInfo(path, 0, versionSize, data))
|
||||||
{
|
{
|
||||||
WORD wLanguage;
|
UINT len;
|
||||||
WORD wCodePage;
|
struct LANGCODEPAGE
|
||||||
} *lcp;
|
|
||||||
|
|
||||||
if (VerQueryValue(data, L"\\VarFileInfo\\Translation", (LPVOID*)&lcp, &len))
|
|
||||||
{
|
|
||||||
WCHAR key[64];
|
|
||||||
LPWSTR value;
|
|
||||||
|
|
||||||
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\ProductName", lcp[0].wLanguage, lcp[0].wCodePage);
|
|
||||||
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len) &&
|
|
||||||
wcscmp(value, L"Rainmeter") == 0)
|
|
||||||
{
|
{
|
||||||
ListView_InsertItem(item, &vitem);
|
WORD wLanguage;
|
||||||
++index;
|
WORD wCodePage;
|
||||||
found = true;
|
} *lcp;
|
||||||
|
|
||||||
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\FileVersion", lcp[0].wLanguage, lcp[0].wCodePage);
|
if (VerQueryValue(data, L"\\VarFileInfo\\Translation", (LPVOID*)&lcp, &len))
|
||||||
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len))
|
{
|
||||||
{
|
WCHAR key[64];
|
||||||
ListView_SetItemText(item, vitem.iItem, 1, value);
|
LPWSTR value;
|
||||||
}
|
|
||||||
|
|
||||||
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\LegalCopyright", lcp[0].wLanguage, lcp[0].wCodePage);
|
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\ProductName", lcp[0].wLanguage, lcp[0].wCodePage);
|
||||||
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len))
|
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len) &&
|
||||||
|
wcscmp(value, L"Rainmeter") == 0)
|
||||||
{
|
{
|
||||||
ListView_SetItemText(item, vitem.iItem, 2, value);
|
ListView_InsertItem(item, &vitem);
|
||||||
|
++index;
|
||||||
|
found = true;
|
||||||
|
|
||||||
|
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\FileVersion", lcp[0].wLanguage, lcp[0].wCodePage);
|
||||||
|
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len))
|
||||||
|
{
|
||||||
|
ListView_SetItemText(item, vitem.iItem, 1, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\LegalCopyright", lcp[0].wLanguage, lcp[0].wCodePage);
|
||||||
|
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len))
|
||||||
|
{
|
||||||
|
ListView_SetItemText(item, vitem.iItem, 2, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete [] data;
|
||||||
|
if (found) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] data;
|
// Try old calling GetPluginVersion/GetPluginAuthor for backwards compatibility
|
||||||
if (found) continue;
|
DWORD err = 0;
|
||||||
}
|
HMODULE dll = CSystem::RmLoadLibrary(path, &err, true);
|
||||||
|
if (dll)
|
||||||
// Try old calling GetPluginVersion/GetPluginAuthor for backwards compatibility
|
|
||||||
DWORD err = 0;
|
|
||||||
HMODULE dll = CSystem::RmLoadLibrary(path, &err, true);
|
|
||||||
if (dll)
|
|
||||||
{
|
|
||||||
ListView_InsertItem(item, &vitem);
|
|
||||||
++index;
|
|
||||||
|
|
||||||
GETPLUGINVERSION GetVersionFunc = (GETPLUGINVERSION)GetProcAddress(dll, "GetPluginVersion");
|
|
||||||
if (GetVersionFunc)
|
|
||||||
{
|
{
|
||||||
UINT version = GetVersionFunc();
|
ListView_InsertItem(item, &vitem);
|
||||||
WCHAR buffer[64];
|
++index;
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%u.%u", version / 1000, version % 1000);
|
|
||||||
ListView_SetItemText(item, vitem.iItem, 1, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
GETPLUGINAUTHOR GetAuthorFunc = (GETPLUGINAUTHOR)GetProcAddress(dll, "GetPluginAuthor");
|
GETPLUGINVERSION GetVersionFunc = (GETPLUGINVERSION)GetProcAddress(dll, "GetPluginVersion");
|
||||||
if (GetAuthorFunc)
|
if (GetVersionFunc)
|
||||||
{
|
|
||||||
LPCTSTR author = GetAuthorFunc();
|
|
||||||
if (author && *author)
|
|
||||||
{
|
{
|
||||||
ListView_SetItemText(item, vitem.iItem, 2, (LPWSTR)author);
|
UINT version = GetVersionFunc();
|
||||||
|
WCHAR buffer[64];
|
||||||
|
_snwprintf_s(buffer, _TRUNCATE, L"%u.%u", version / 1000, version % 1000);
|
||||||
|
ListView_SetItemText(item, vitem.iItem, 1, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GETPLUGINAUTHOR GetAuthorFunc = (GETPLUGINAUTHOR)GetProcAddress(dll, "GetPluginAuthor");
|
||||||
|
if (GetAuthorFunc)
|
||||||
|
{
|
||||||
|
LPCTSTR author = GetAuthorFunc();
|
||||||
|
if (author && *author)
|
||||||
|
{
|
||||||
|
ListView_SetItemText(item, vitem.iItem, 2, (LPWSTR)author);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeLibrary(dll);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogWithArgs(LOG_ERROR, L"Unable to load plugin: %s (%u)", tmpSz.c_str(), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(dll);
|
|
||||||
}
|
}
|
||||||
else
|
while (FindNextFile(hSearch, &fd));
|
||||||
{
|
FindClose(hSearch);
|
||||||
LogWithArgs(LOG_ERROR, L"Unable to load plugin: %s (%u)", tmpSz.c_str(), err);
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
while (FindNextFile(hSearch, &fileData));
|
|
||||||
|
|
||||||
FindClose(hSearch);
|
findPlugins(Rainmeter->GetPluginPath());
|
||||||
|
findPlugins(Rainmeter->GetUserPluginPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -117,22 +117,30 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring& plugin = parser.ReadString(section, L"Plugin", L"");
|
const std::wstring& plugin = parser.ReadString(section, L"Plugin", L"");
|
||||||
std::wstring pluginFile = Rainmeter->GetPluginPath();
|
|
||||||
size_t pos = plugin.find_last_of(L"\\/");
|
size_t pos = plugin.find_last_of(L"\\/");
|
||||||
|
std::wstring pluginName;
|
||||||
if (pos != std::wstring::npos)
|
if (pos != std::wstring::npos)
|
||||||
{
|
{
|
||||||
pluginFile.append(plugin, pos, plugin.length() - pos);
|
pluginName.assign(plugin, pos, plugin.length() - pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pluginFile += plugin;
|
pluginName = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First try from program path
|
||||||
|
std::wstring pluginFile = Rainmeter->GetPluginPath() + pluginName;
|
||||||
m_Plugin = CSystem::RmLoadLibrary(pluginFile.c_str());
|
m_Plugin = CSystem::RmLoadLibrary(pluginFile.c_str());
|
||||||
if (m_Plugin == NULL)
|
if (!m_Plugin)
|
||||||
{
|
{
|
||||||
LogWithArgs(LOG_ERROR, L"Plugin: \"%s\" not found", pluginFile.c_str());
|
// Try from settings path
|
||||||
return;
|
pluginFile = Rainmeter->GetUserPluginPath() + pluginName;
|
||||||
|
m_Plugin = CSystem::RmLoadLibrary(pluginFile.c_str());
|
||||||
|
if (!m_Plugin)
|
||||||
|
{
|
||||||
|
LogWithArgs(LOG_ERROR, L"Plugin: \"%s\" not found", pluginName.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FARPROC initializeFunc = GetProcAddress(m_Plugin, "Initialize");
|
FARPROC initializeFunc = GetProcAddress(m_Plugin, "Initialize");
|
||||||
|
@ -804,6 +804,8 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
|
|
||||||
// Set file locations
|
// Set file locations
|
||||||
{
|
{
|
||||||
|
m_SettingsPath = ExtractPath(m_IniFile);
|
||||||
|
|
||||||
size_t len = m_IniFile.length();
|
size_t len = m_IniFile.length();
|
||||||
if (len > 4 && _wcsicmp(iniFile + (len - 4), L".ini") == 0)
|
if (len > 4 && _wcsicmp(iniFile + (len - 4), L".ini") == 0)
|
||||||
{
|
{
|
||||||
@ -900,25 +902,6 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
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);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
// Folder just created, so copy default skins there
|
|
||||||
std::wstring from = GetDefaultSkinPath();
|
|
||||||
from += L"*.*";
|
|
||||||
CSystem::CopyFiles(from, m_SkinPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring themesPath = GetSettingsPath();
|
|
||||||
themesPath += L"Themes\\";
|
|
||||||
result = CreateDirectory(themesPath.c_str(), NULL);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
// Copy themes to %APPDATA%
|
|
||||||
std::wstring from = GetDefaultThemePath();
|
|
||||||
from += L"*.*";
|
|
||||||
CSystem::CopyFiles(from, themesPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile);
|
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile);
|
||||||
}
|
}
|
||||||
@ -927,6 +910,9 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
|||||||
m_SkinPath = m_Path + L"Skins\\";
|
m_SkinPath = m_Path + L"Skins\\";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create user skins, themes, addons, and plugins folders if needed
|
||||||
|
CreateComponentFolders();
|
||||||
|
|
||||||
// Create a default Rainmeter.ini file if needed
|
// Create a default Rainmeter.ini file if needed
|
||||||
if (_waccess(iniFile, 0) == -1)
|
if (_waccess(iniFile, 0) == -1)
|
||||||
{
|
{
|
||||||
@ -1194,10 +1180,51 @@ void CRainmeter::CreateDataFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRainmeter::CreateComponentFolders()
|
||||||
|
{
|
||||||
|
if (CreateDirectory(m_SkinPath.c_str(), NULL))
|
||||||
|
{
|
||||||
|
// Folder just created, so copy default skins there
|
||||||
|
std::wstring from = GetDefaultSkinPath();
|
||||||
|
from += L"*.*";
|
||||||
|
CSystem::CopyFiles(from, m_SkinPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring path = GetThemePath();
|
||||||
|
if (_waccess(path.c_str(), 0) == -1)
|
||||||
|
{
|
||||||
|
std::wstring from = GetDefaultThemePath();
|
||||||
|
if (_waccess(from.c_str(), 0) != -1)
|
||||||
|
{
|
||||||
|
CSystem::CopyFiles(from, m_SettingsPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
path = GetUserPluginPath();
|
||||||
|
if (_waccess(path.c_str(), 0) == -1)
|
||||||
|
{
|
||||||
|
std::wstring from = GetDefaultPluginPath();
|
||||||
|
if (_waccess(from.c_str(), 0) != -1)
|
||||||
|
{
|
||||||
|
CSystem::CopyFiles(from, m_SettingsPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
path = GetAddonPath();
|
||||||
|
if (_waccess(path.c_str(), 0) == -1)
|
||||||
|
{
|
||||||
|
std::wstring from = GetDefaultAddonPath();
|
||||||
|
if (_waccess(from.c_str(), 0) != -1)
|
||||||
|
{
|
||||||
|
CSystem::CopyFiles(from, m_SettingsPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CRainmeter::ReloadSettings()
|
void CRainmeter::ReloadSettings()
|
||||||
{
|
{
|
||||||
ScanForSkins(m_SkinPath);
|
ScanForSkins(m_SkinPath);
|
||||||
ScanForThemes(GetSettingsPath() + L"Themes");
|
ScanForThemes(GetThemePath());
|
||||||
ReadGeneralSettings(m_IniFile);
|
ReadGeneralSettings(m_IniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1339,6 +1366,7 @@ void CRainmeter::CreateMeterWindow(const std::wstring& folderPath, const std::ws
|
|||||||
|
|
||||||
if (mw)
|
if (mw)
|
||||||
{
|
{
|
||||||
|
// Note: May modify existing key
|
||||||
m_MeterWindows[folderPath] = mw;
|
m_MeterWindows[folderPath] = mw;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -136,13 +136,17 @@ public:
|
|||||||
const std::wstring& GetIniFile() { return m_IniFile; }
|
const std::wstring& GetIniFile() { return m_IniFile; }
|
||||||
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& GetSettingsPath() { return m_SettingsPath; }
|
||||||
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
||||||
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); }
|
std::wstring GetThemePath() { return m_SettingsPath + L"Themes\\"; }
|
||||||
std::wstring GetPluginPath() { return m_Path + L"Plugins\\"; }
|
std::wstring GetPluginPath() { return m_Path + L"Plugins\\"; }
|
||||||
std::wstring GetAddonPath() { return m_Path + L"Addons\\"; }
|
std::wstring GetUserPluginPath() { return m_SettingsPath + L"Plugins\\"; }
|
||||||
|
std::wstring GetAddonPath() { return m_SettingsPath + L"Addons\\"; }
|
||||||
|
|
||||||
std::wstring GetDefaultSkinPath() { return m_Path + L"Defaults\\Skins\\"; }
|
std::wstring GetDefaultSkinPath() { return m_Path + L"Defaults\\Skins\\"; }
|
||||||
std::wstring GetDefaultThemePath() { return m_Path + L"Defaults\\Themes\\"; }
|
std::wstring GetDefaultThemePath() { return m_Path + L"Defaults\\Themes\\"; }
|
||||||
|
std::wstring GetDefaultPluginPath() { return m_Path + L"Defaults\\Plugins\\"; }
|
||||||
|
std::wstring GetDefaultAddonPath() { return m_Path + L"Defaults\\Addons\\"; }
|
||||||
|
|
||||||
const std::wstring& GetDrive() { return m_Drive; }
|
const std::wstring& GetDrive() { return m_Drive; }
|
||||||
|
|
||||||
@ -253,6 +257,7 @@ private:
|
|||||||
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
|
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
|
||||||
void CreateOptionsFile();
|
void CreateOptionsFile();
|
||||||
void CreateDataFile();
|
void CreateDataFile();
|
||||||
|
void CreateComponentFolders();
|
||||||
void SetLogging(bool logging);
|
void SetLogging(bool logging);
|
||||||
void TestSettingsFile(bool bDefaultIniLocation);
|
void TestSettingsFile(bool bDefaultIniLocation);
|
||||||
|
|
||||||
@ -268,6 +273,7 @@ private:
|
|||||||
std::wstring m_DataFile;
|
std::wstring m_DataFile;
|
||||||
std::wstring m_StatsFile;
|
std::wstring m_StatsFile;
|
||||||
std::wstring m_LogFile;
|
std::wstring m_LogFile;
|
||||||
|
std::wstring m_SettingsPath;
|
||||||
std::wstring m_SkinPath;
|
std::wstring m_SkinPath;
|
||||||
|
|
||||||
std::wstring m_Drive;
|
std::wstring m_Drive;
|
||||||
|
Loading…
Reference in New Issue
Block a user