@@ -110,10 +110,9 @@ bool Main(const fml::CommandLine& command_line) {
110110
111111 auto spriv_file_name = std::filesystem::absolute (
112112 std::filesystem::current_path () / switches.spirv_file_name );
113- if (!fml::WriteAtomically (
114- *switches.working_directory ,
115- reinterpret_cast <const char *>(spriv_file_name.u8string ().c_str ()),
116- *compiler.GetSPIRVAssembly ())) {
113+ if (!fml::WriteAtomically (*switches.working_directory ,
114+ Utf8FromPath (spriv_file_name).c_str (),
115+ *compiler.GetSPIRVAssembly ())) {
117116 std::cerr << " Could not write file to " << switches.spirv_file_name
118117 << std::endl;
119118 return false ;
@@ -144,10 +143,9 @@ bool Main(const fml::CommandLine& command_line) {
144143 std::cerr << " Runtime stage data could not be created." << std::endl;
145144 return false ;
146145 }
147- if (!fml::WriteAtomically (*switches.working_directory , //
148- reinterpret_cast <const char *>(
149- sl_file_name.u8string ().c_str ()), //
150- *stage_data_mapping //
146+ if (!fml::WriteAtomically (*switches.working_directory , //
147+ Utf8FromPath (sl_file_name).c_str (), //
148+ *stage_data_mapping //
151149 )) {
152150 std::cerr << " Could not write file to " << switches.sl_file_name
153151 << std::endl;
@@ -159,10 +157,9 @@ bool Main(const fml::CommandLine& command_line) {
159157 return false ;
160158 }
161159 } else {
162- if (!fml::WriteAtomically (
163- *switches.working_directory ,
164- reinterpret_cast <const char *>(sl_file_name.u8string ().c_str ()),
165- *compiler.GetSLShaderSource ())) {
160+ if (!fml::WriteAtomically (*switches.working_directory ,
161+ Utf8FromPath (sl_file_name).c_str (),
162+ *compiler.GetSLShaderSource ())) {
166163 std::cerr << " Could not write file to " << switches.sl_file_name
167164 << std::endl;
168165 return false ;
@@ -176,8 +173,7 @@ bool Main(const fml::CommandLine& command_line) {
176173 std::filesystem::current_path () / switches.reflection_json_name );
177174 if (!fml::WriteAtomically (
178175 *switches.working_directory ,
179- reinterpret_cast <const char *>(
180- reflection_json_name.u8string ().c_str ()),
176+ Utf8FromPath (reflection_json_name).c_str (),
181177 *compiler.GetReflector ()->GetReflectionJSON ())) {
182178 std::cerr << " Could not write reflection json to "
183179 << switches.reflection_json_name << std::endl;
@@ -191,8 +187,7 @@ bool Main(const fml::CommandLine& command_line) {
191187 switches.reflection_header_name .c_str ());
192188 if (!fml::WriteAtomically (
193189 *switches.working_directory ,
194- reinterpret_cast <const char *>(
195- reflection_header_name.u8string ().c_str ()),
190+ Utf8FromPath (reflection_header_name).c_str (),
196191 *compiler.GetReflector ()->GetReflectionHeader ())) {
197192 std::cerr << " Could not write reflection header to "
198193 << switches.reflection_header_name << std::endl;
@@ -205,8 +200,7 @@ bool Main(const fml::CommandLine& command_line) {
205200 std::filesystem::absolute (std::filesystem::current_path () /
206201 switches.reflection_cc_name .c_str ());
207202 if (!fml::WriteAtomically (*switches.working_directory ,
208- reinterpret_cast <const char *>(
209- reflection_cc_name.u8string ().c_str ()),
203+ Utf8FromPath (reflection_cc_name).c_str (),
210204 *compiler.GetReflector ()->GetReflectionCC ())) {
211205 std::cerr << " Could not write reflection CC to "
212206 << switches.reflection_cc_name << std::endl;
@@ -234,10 +228,9 @@ bool Main(const fml::CommandLine& command_line) {
234228 }
235229 auto depfile_path = std::filesystem::absolute (
236230 std::filesystem::current_path () / switches.depfile_path .c_str ());
237- if (!fml::WriteAtomically (
238- *switches.working_directory ,
239- reinterpret_cast <const char *>(depfile_path.u8string ().c_str ()),
240- *compiler.CreateDepfileContents ({result_file}))) {
231+ if (!fml::WriteAtomically (*switches.working_directory ,
232+ Utf8FromPath (depfile_path).c_str (),
233+ *compiler.CreateDepfileContents ({result_file}))) {
241234 std::cerr << " Could not write depfile to " << switches.depfile_path
242235 << std::endl;
243236 return false ;
0 commit comments