mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
[settings] loading powerpreview module from subfolder (#2709)
* loading module in sub-folders * reverted un-related change
This commit is contained in:
@@ -122,6 +122,9 @@ int runner(bool isProcessElevated)
|
|||||||
chdir_current_executable();
|
chdir_current_executable();
|
||||||
// Load Powertyos DLLS
|
// Load Powertyos DLLS
|
||||||
// For now only load known DLLs
|
// For now only load known DLLs
|
||||||
|
|
||||||
|
std::wstring baseModuleFolder = L"modules/";
|
||||||
|
|
||||||
std::unordered_set<std::wstring> known_dlls = {
|
std::unordered_set<std::wstring> known_dlls = {
|
||||||
L"shortcut_guide.dll",
|
L"shortcut_guide.dll",
|
||||||
L"fancyzones.dll",
|
L"fancyzones.dll",
|
||||||
@@ -131,19 +134,28 @@ int runner(bool isProcessElevated)
|
|||||||
L"powerpreview.dll",
|
L"powerpreview.dll",
|
||||||
L"KeyboardManager.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")
|
for (auto& file : std::filesystem::directory_iterator(baseModuleFolder + subfolderName))
|
||||||
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 (...)
|
|
||||||
{
|
{
|
||||||
|
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
|
// Start initial powertoys
|
||||||
|
|||||||
Reference in New Issue
Block a user