diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index 1fb1a82d26..fa947b9ec1 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -406,10 +406,6 @@ - - - - @@ -742,7 +738,6 @@ - @@ -783,6 +778,7 @@ + diff --git a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj index 091cd49d22..0496566ad4 100644 --- a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj +++ b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj @@ -49,11 +49,11 @@ true - $(SolutionDir)$(Platform)\$(Configuration)\modules\ + $(SolutionDir)$(Platform)\$(Configuration)\modules\launcher false - $(SolutionDir)$(Platform)\$(Configuration)\modules\ + $(SolutionDir)$(Platform)\$(Configuration)\modules\launcher diff --git a/src/runner/main.cpp b/src/runner/main.cpp index fceba7843f..0504df2661 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -127,48 +127,27 @@ int runner(bool isProcessElevated) notifications::register_background_toast_handler(); chdir_current_executable(); - // Load Powertoys DLLS - // For now only load known DLLs + // Load Powertoys DLLs - std::wstring baseModuleFolder = L"modules/"; - - std::unordered_set known_dlls = { - L"ShortcutGuide.dll", - L"fancyzones.dll", - L"PowerRenameExt.dll", - L"Microsoft.Launcher.dll", - L"ImageResizerExt.dll", - L"powerpreview.dll", - L"KeyboardManager.dll" + const std::array knownModules = { + L"modules/FancyZones/fancyzones.dll", + L"modules/FileExplorerPreview/powerpreview.dll", + L"modules/ImageResizer/ImageResizerExt.dll", + L"modules/KeyboardManager/KeyboardManager.dll", + L"modules/Launcher/Microsoft.Launcher.dll", + L"modules/PowerRename/PowerRenameExt.dll", + L"modules/ShortcutGuide/ShortcutGuide.dll", }; - // TODO(stefan): When all modules get their OutputDir delete this and simplify "search for .dll logic" - std::unordered_set module_folders = { - L"", - L"FileExplorerPreview/", - L"FancyZones/", - L"ImageResizer/", - L"PowerRename/", - L"ShortcutGuide/", - L"KeyboardManager/" - }; - - for (std::wstring subfolderName : module_folders) + for (const auto & moduleSubdir : knownModules) { - for (auto& file : std::filesystem::directory_iterator(baseModuleFolder + subfolderName)) + try + { + auto module = load_powertoy(moduleSubdir); + 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 diff --git a/src/runner/powertoy_module.cpp b/src/runner/powertoy_module.cpp index 73df324d02..988fc08516 100644 --- a/src/runner/powertoy_module.cpp +++ b/src/runner/powertoy_module.cpp @@ -7,9 +7,9 @@ std::map& modules() return modules; } -PowertoyModule load_powertoy(const std::wstring& filename) +PowertoyModule load_powertoy(const std::wstring_view filename) { - auto handle = winrt::check_pointer(LoadLibraryW(filename.c_str())); + auto handle = winrt::check_pointer(LoadLibraryW(filename.data())); auto create = reinterpret_cast(GetProcAddress(handle, "powertoy_create")); if (!create) { diff --git a/src/runner/powertoy_module.h b/src/runner/powertoy_module.h index 8da7515ed0..7be349a231 100644 --- a/src/runner/powertoy_module.h +++ b/src/runner/powertoy_module.h @@ -49,5 +49,5 @@ private: std::unique_ptr module; }; -PowertoyModule load_powertoy(const std::wstring& filename); +PowertoyModule load_powertoy(const std::wstring_view filename); std::map& modules();