Skip to content

Commit c55852d

Browse files
committed
Always convert std::filesystem paths in ImpellerC to UTF-8 strings (flutter#36158)
1 parent a4ff2c5 commit c55852d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

impeller/compiler/impellerc_main.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ bool Main(const fml::CommandLine& command_line) {
9191
auto spriv_file_name = std::filesystem::absolute(
9292
std::filesystem::current_path() / switches.spirv_file_name);
9393
if (!fml::WriteAtomically(*switches.working_directory,
94-
spriv_file_name.string().c_str(),
94+
spriv_file_name.u8string().c_str(),
9595
*compiler.GetSPIRVAssembly())) {
9696
std::cerr << "Could not write file to " << switches.spirv_file_name
9797
<< std::endl;
@@ -118,9 +118,9 @@ bool Main(const fml::CommandLine& command_line) {
118118
std::cerr << "Runtime stage data could not be created." << std::endl;
119119
return false;
120120
}
121-
if (!fml::WriteAtomically(*switches.working_directory, //
122-
sl_file_name.string().c_str(), //
123-
*stage_data_mapping //
121+
if (!fml::WriteAtomically(*switches.working_directory, //
122+
sl_file_name.u8string().c_str(), //
123+
*stage_data_mapping //
124124
)) {
125125
std::cerr << "Could not write file to " << switches.sl_file_name
126126
<< std::endl;
@@ -133,7 +133,7 @@ bool Main(const fml::CommandLine& command_line) {
133133
}
134134
} else {
135135
if (!fml::WriteAtomically(*switches.working_directory,
136-
sl_file_name.string().c_str(),
136+
sl_file_name.u8string().c_str(),
137137
*compiler.GetSLShaderSource())) {
138138
std::cerr << "Could not write file to " << switches.sl_file_name
139139
<< std::endl;
@@ -148,7 +148,7 @@ bool Main(const fml::CommandLine& command_line) {
148148
std::filesystem::current_path() / switches.reflection_json_name);
149149
if (!fml::WriteAtomically(
150150
*switches.working_directory,
151-
reflection_json_name.string().c_str(),
151+
reflection_json_name.u8string().c_str(),
152152
*compiler.GetReflector()->GetReflectionJSON())) {
153153
std::cerr << "Could not write reflection json to "
154154
<< switches.reflection_json_name << std::endl;
@@ -162,7 +162,7 @@ bool Main(const fml::CommandLine& command_line) {
162162
switches.reflection_header_name.c_str());
163163
if (!fml::WriteAtomically(
164164
*switches.working_directory,
165-
reflection_header_name.string().c_str(),
165+
reflection_header_name.u8string().c_str(),
166166
*compiler.GetReflector()->GetReflectionHeader())) {
167167
std::cerr << "Could not write reflection header to "
168168
<< switches.reflection_header_name << std::endl;
@@ -175,7 +175,7 @@ bool Main(const fml::CommandLine& command_line) {
175175
std::filesystem::absolute(std::filesystem::current_path() /
176176
switches.reflection_cc_name.c_str());
177177
if (!fml::WriteAtomically(*switches.working_directory,
178-
reflection_cc_name.string().c_str(),
178+
reflection_cc_name.u8string().c_str(),
179179
*compiler.GetReflector()->GetReflectionCC())) {
180180
std::cerr << "Could not write reflection CC to "
181181
<< switches.reflection_cc_name << std::endl;
@@ -203,7 +203,7 @@ bool Main(const fml::CommandLine& command_line) {
203203
auto depfile_path = std::filesystem::absolute(
204204
std::filesystem::current_path() / switches.depfile_path.c_str());
205205
if (!fml::WriteAtomically(*switches.working_directory,
206-
depfile_path.string().c_str(),
206+
depfile_path.u8string().c_str(),
207207
*compiler.CreateDepfileContents({result_file}))) {
208208
std::cerr << "Could not write depfile to " << switches.depfile_path
209209
<< std::endl;

impeller/compiler/utilities.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace impeller {
1212
namespace compiler {
1313

1414
std::string InferShaderNameFromPath(std::string_view path) {
15-
return std::filesystem::path{path}.stem().string();
15+
return std::filesystem::path{path}.stem().u8string();
1616
}
1717

1818
std::string ConvertToCamelCase(std::string_view string) {

0 commit comments

Comments
 (0)