MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / GetIconFileForPlugin

Method GetIconFileForPlugin

PathCopyCopy/src/PathCopyCopySettings.cpp:769–798  ·  view source on GitHub ↗

Looks in the Icons key and attempts to find an icon file for the given plugin. @param p_PluginId ID of plugin to look for. @return If an icon file exists for this plugin, will return its path. If the default icon is to be used, will return an empty string. If no icon is specified for this plugin, will return a value whose has_value() method returns false.

Source from the content-addressed store, hash-verified

767 // for this plugin, will return a value whose has_value() method returns false.
768 //
769 std::optional<std::wstring> Settings::GetIconFileForPlugin(const CLSID& p_PluginId) const
770 {
771 // Perform late-revising.
772 Revise();
773
774 // Assume there's no info for the icon.
775 std::optional<std::wstring> resultingIconFile;
776
777 // Convert plugin ID to string.
778 StOleStr pluginIdAsString;
779 const HRESULT hRes = ::StringFromCLSID(p_PluginId, &pluginIdAsString);
780 if (SUCCEEDED(hRes)) {
781 // Look for a value for this plugin in the icons key.
782 std::wstring iconFile;
783 if (PluginUtils::ReadRegistryStringValue(m_IconsKey, pluginIdAsString, iconFile) == ERROR_SUCCESS) {
784 // Check if it's the marker value pointing to the default icon.
785 if (iconFile == DEFAULT_ICON_MARKER_STRING) {
786 // Return an empty string to note this.
787 resultingIconFile.emplace();
788 } else {
789 // Return the value, which should point to icon file.
790 resultingIconFile = iconFile;
791 }
792 }
793 } else {
794 throw SettingsException(hRes);
795 }
796
797 return resultingIconFile;
798 }
799
800 //
801 // Checks whether the administrator has disabled editing of the

Callers 1

AddPluginToMenuMethod · 0.45

Calls 1

SettingsExceptionClass · 0.85

Tested by

no test coverage detected