[settings] loading powerpreview module from subfolder (#2709)

* loading module in sub-folders

* reverted un-related change
This commit is contained in:
Lavius Motileng 2020-05-08 08:23:18 -07:00 committed by GitHub
parent 1ab0a5182f
commit 6b2955f135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,9 @@ int runner(bool isProcessElevated)
chdir_current_executable();
// Load Powertyos DLLS
// For now only load known DLLs
std::wstring baseModuleFolder = L"modules/";
std::unordered_set<std::wstring> known_dlls = {
L"shortcut_guide.dll",
L"fancyzones.dll",
@ -131,19 +134,28 @@ int runner(bool isProcessElevated)
L"powerpreview.dll",
L"KeyboardManager.dll"
};
for (auto& file : std::filesystem::directory_iterator(L"modules/"))
std::unordered_set<std::wstring> module_folders = {
L"",
L"FileExplorerPreview/",
};
for (std::wstring subfolderName : module_folders)
{
if (file.path().extension() != L".dll")
continue;
if (known_dlls.find(file.path().filename()) == known_dlls.end())
continue;
try
{
auto module = load_powertoy(file.path().wstring());
modules().emplace(module->get_name(), std::move(module));
}
catch (...)
for (auto& file : std::filesystem::directory_iterator(baseModuleFolder + subfolderName))
{
if (file.path().extension() != L".dll")
continue;
if (known_dlls.find(file.path().filename()) == known_dlls.end())
continue;
try
{
auto module = load_powertoy(file.path().wstring());
modules().emplace(module->get_name(), std::move(module));
}
catch (...)
{
}
}
}
// Start initial powertoys