MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / GetFolderPathForDisplay

Function GetFolderPathForDisplay

Explorer++/Helper/ShellHelper.cpp:821–842  ·  view source on GitHub ↗

Returns either the parsing path for the specified item, or its in folder name. The in folder name will be returned when the parsing path is a GUID (which typically shouldn't be displayed to the user).

Source from the content-addressed store, hash-verified

819// folder name. The in folder name will be returned when the parsing
820// path is a GUID (which typically shouldn't be displayed to the user).
821std::optional<std::wstring> GetFolderPathForDisplay(PCIDLIST_ABSOLUTE pidl)
822{
823 TCHAR parsingPath[MAX_PATH];
824 HRESULT hr = GetDisplayName(pidl, parsingPath, SIZEOF_ARRAY(parsingPath), SHGDN_FORPARSING);
825
826 if (FAILED(hr))
827 {
828 return std::nullopt;
829 }
830
831 if (IsPathGUID(parsingPath))
832 {
833 hr = GetDisplayName(pidl, parsingPath, SIZEOF_ARRAY(parsingPath), SHGDN_INFOLDER);
834
835 if (FAILED(hr))
836 {
837 return std::nullopt;
838 }
839 }
840
841 return parsingPath;
842}
843
844/* Returns TRUE if a path is a GUID;
845i.e. of the form:

Callers 2

UpdateTextAndIconMethod · 0.85
OnGetDispInfoMethod · 0.85

Calls 2

GetDisplayNameFunction · 0.85
IsPathGUIDFunction · 0.85

Tested by

no test coverage detected