mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-03 03:19:08 +08:00
[settings] loading powerpreview module from subfolder (#2709)
* loading module in sub-folders * reverted un-related change
This commit is contained in:
parent
1ab0a5182f
commit
6b2955f135
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user