Skip to content

Commit 567ad09

Browse files
Check executable directory for system plugins (in plugins folder) on Windows
1 parent b8bfd1d commit 567ad09

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

PluginManager.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#include "OpenRGBThemeManager.h"
1414
#include "SettingsManager.h"
1515

16+
#ifdef _WIN32
17+
#include <Windows.h>
18+
#endif
19+
1620
PluginManager::PluginManager()
1721
{
1822
/*---------------------------------------------------------*\
@@ -64,6 +68,24 @@ void PluginManager::ScanAndLoadPlugins()
6468
\*---------------------------------------------------------*/
6569
ScanAndLoadPluginsFrom(OPENRGB_SYSTEM_PLUGIN_DIRECTORY, true);
6670
#endif
71+
72+
#ifdef _WIN32
73+
/*---------------------------------------------------------*\
74+
| Get the exe folder plugins directory (Windows) |
75+
| |
76+
| On Windows, system plugins are located in a folder called |
77+
| "plugins" inside the folder where the OpenRGB.exe file is |
78+
| installed. Typically, C:\Program Files\OpenRGB but other |
79+
| install paths are allowed. |
80+
\*---------------------------------------------------------*/
81+
char path[MAX_PATH];
82+
GetModuleFileName(NULL, path, MAX_PATH);
83+
84+
filesystem::path exe_dir(path);
85+
exe_dir = exe_dir.remove_filename() / plugins_path;
86+
87+
ScanAndLoadPluginsFrom(exe_dir, true);
88+
#endif
6789
}
6890

6991
void PluginManager::ScanAndLoadPluginsFrom(const filesystem::path & plugins_dir, bool is_system)

0 commit comments

Comments
 (0)