@@ -71,17 +71,31 @@ namespace cppwinrt
7171 }
7272 }
7373
74+ enum class xml_requirement
75+ {
76+ required = 0 ,
77+ optional
78+ };
79+
7480 inline void add_files_from_xml (
7581 std::set<std::string>& files,
7682 std::string const & sdk_version,
7783 std::filesystem::path const & xml_path,
78- std::filesystem::path const & sdk_path)
84+ std::filesystem::path const & sdk_path,
85+ xml_requirement xml_path_requirement)
7986 {
8087 com_ptr<IStream> stream;
8188
82- check_xml ( SHCreateStreamOnFileW (
89+ auto streamResult = SHCreateStreamOnFileW (
8390 xml_path.c_str (),
84- STGM_READ, &stream.ptr ));
91+ STGM_READ, &stream.ptr );
92+ if (xml_path_requirement == xml_requirement::optional &&
93+ (streamResult == HRESULT_FROM_WIN32 (ERROR_FILE_NOT_FOUND) ||
94+ streamResult == HRESULT_FROM_WIN32 (ERROR_PATH_NOT_FOUND)))
95+ {
96+ return ;
97+ }
98+ check_xml (streamResult);
8599
86100 com_ptr<IXmlReader> reader;
87101
@@ -462,7 +476,7 @@ namespace cppwinrt
462476 xml_path /= sdk_version;
463477 xml_path /= L" Platform.xml" ;
464478
465- add_files_from_xml (files, sdk_version, xml_path, sdk_path);
479+ add_files_from_xml (files, sdk_version, xml_path, sdk_path, xml_requirement::required );
466480
467481 if (path.back () != ' +' )
468482 {
@@ -474,7 +488,8 @@ namespace cppwinrt
474488 xml_path = item.path () / sdk_version;
475489 xml_path /= L" SDKManifest.xml" ;
476490
477- add_files_from_xml (files, sdk_version, xml_path, sdk_path);
491+ // Not all Extension SDKs include an SDKManifest.xml file; ignore those which do not (e.g. WindowsIoT).
492+ add_files_from_xml (files, sdk_version, xml_path, sdk_path, xml_requirement::optional);
478493 }
479494
480495 continue ;
0 commit comments