@@ -71,17 +71,31 @@ namespace cppwinrt
71
71
}
72
72
}
73
73
74
+ enum class xml_requirement
75
+ {
76
+ required = 0 ,
77
+ optional
78
+ };
79
+
74
80
inline void add_files_from_xml (
75
81
std::set<std::string>& files,
76
82
std::string const & sdk_version,
77
83
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)
79
86
{
80
87
com_ptr<IStream> stream;
81
88
82
- check_xml ( SHCreateStreamOnFileW (
89
+ auto streamResult = SHCreateStreamOnFileW (
83
90
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);
85
99
86
100
com_ptr<IXmlReader> reader;
87
101
@@ -462,7 +476,7 @@ namespace cppwinrt
462
476
xml_path /= sdk_version;
463
477
xml_path /= L" Platform.xml" ;
464
478
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 );
466
480
467
481
if (path.back () != ' +' )
468
482
{
@@ -474,7 +488,8 @@ namespace cppwinrt
474
488
xml_path = item.path () / sdk_version;
475
489
xml_path /= L" SDKManifest.xml" ;
476
490
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);
478
493
}
479
494
480
495
continue ;
0 commit comments