File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 88#include " component_writers.h"
99#include " file_writers.h"
1010#include " type_writers.h"
11+ #include < winternl.h>
1112
1213namespace cppwinrt
1314{
@@ -374,5 +375,7 @@ Where <spec> is one or more of:
374375
375376int main (int const argc, char ** argv)
376377{
378+ // Dynamically enable long path support
379+ ((unsigned char *)(NtCurrentTeb ()->ProcessEnvironmentBlock ))[3 ] |= 0x80 ;
377380 return cppwinrt::run (argc, argv);
378381}
Original file line number Diff line number Diff line change @@ -157,9 +157,18 @@ namespace cppwinrt
157157 {
158158 if (!file_equal (filename))
159159 {
160- std::ofstream file{ filename, std::ios::out | std::ios::binary };
161- file.write (m_first.data (), m_first.size ());
162- file.write (m_second.data (), m_second.size ());
160+ std::ofstream file;
161+ file.exceptions (std::ofstream::failbit | std::ofstream::badbit);
162+ try
163+ {
164+ file.open (filename, std::ios::out | std::ios::binary);
165+ file.write (m_first.data (), m_first.size ());
166+ file.write (m_second.data (), m_second.size ());
167+ }
168+ catch (std::ofstream::failure const & e)
169+ {
170+ throw std::filesystem::filesystem_error (e.what (), filename, std::io_errc::stream);
171+ }
163172 }
164173 m_first.clear ();
165174 m_second.clear ();
You can’t perform that action at this time.
0 commit comments