Check executable directory for system plugins (in plugins folder) on Windows

This commit is contained in:
Adam Honse
2025-01-13 23:27:46 -06:00
parent b8bfd1dddc
commit 567ad09506

View File

@@ -13,6 +13,10 @@
#include "OpenRGBThemeManager.h"
#include "SettingsManager.h"
#ifdef _WIN32
#include <Windows.h>
#endif
PluginManager::PluginManager()
{
/*---------------------------------------------------------*\
@@ -64,6 +68,24 @@ void PluginManager::ScanAndLoadPlugins()
\*---------------------------------------------------------*/
ScanAndLoadPluginsFrom(OPENRGB_SYSTEM_PLUGIN_DIRECTORY, true);
#endif
#ifdef _WIN32
/*---------------------------------------------------------*\
| Get the exe folder plugins directory (Windows) |
| |
| On Windows, system plugins are located in a folder called |
| "plugins" inside the folder where the OpenRGB.exe file is |
| installed. Typically, C:\Program Files\OpenRGB but other |
| install paths are allowed. |
\*---------------------------------------------------------*/
char path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
filesystem::path exe_dir(path);
exe_dir = exe_dir.remove_filename() / plugins_path;
ScanAndLoadPluginsFrom(exe_dir, true);
#endif
}
void PluginManager::ScanAndLoadPluginsFrom(const filesystem::path & plugins_dir, bool is_system)