Skip to content

Commit eb30380

Browse files
bderoschwa423
authored andcommitted
Apply the Windows friendly path solution in remaining spots (flutter#37344)
1 parent 729b34b commit eb30380

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

impeller/compiler/impellerc_main.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ bool Main(const fml::CommandLine& command_line) {
7777
reflector_options.entry_point_name = options.entry_point_name;
7878
reflector_options.shader_name =
7979
InferShaderNameFromPath(switches.source_file_name);
80-
reflector_options.header_file_name =
81-
ToUtf8(std::filesystem::path{switches.reflection_header_name}
82-
.filename()
83-
.native());
80+
reflector_options.header_file_name = Utf8FromPath(
81+
std::filesystem::path{switches.reflection_header_name}.filename());
8482

8583
// Generate SkSL if needed.
8684
std::shared_ptr<fml::Mapping> sksl_mapping;

impeller/compiler/switches.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static SourceType SourceTypeFromCommandLine(
100100
Switches::Switches(const fml::CommandLine& command_line)
101101
: target_platform(TargetPlatformFromCommandLine(command_line)),
102102
working_directory(std::make_shared<fml::UniqueFD>(fml::OpenDirectory(
103-
ToUtf8(std::filesystem::current_path().native()).c_str(),
103+
Utf8FromPath(std::filesystem::current_path()).c_str(),
104104
false, // create if necessary,
105105
fml::FilePermission::kRead))),
106106
source_file_name(command_line.GetOptionValueWithDefault("input", "")),

impeller/compiler/types.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <sstream>
99

1010
#include "flutter/fml/logging.h"
11+
#include "impeller/compiler/utilities.h"
1112

1213
namespace impeller {
1314
namespace compiler {
@@ -77,7 +78,7 @@ std::string EntryPointFunctionNameFromSourceName(const std::string& file_name,
7778
SourceType type) {
7879
std::stringstream stream;
7980
std::filesystem::path file_path(file_name);
80-
stream << ToUtf8(file_path.stem().native()) << "_";
81+
stream << Utf8FromPath(file_path.stem()) << "_";
8182
switch (type) {
8283
case SourceType::kUnknown:
8384
stream << "unknown";
@@ -253,15 +254,6 @@ std::string TargetPlatformSLExtension(TargetPlatform platform) {
253254
FML_UNREACHABLE();
254255
}
255256

256-
std::string ToUtf8(const std::wstring& wstring) {
257-
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
258-
return myconv.to_bytes(wstring);
259-
}
260-
261-
std::string ToUtf8(const std::string& string) {
262-
return string;
263-
}
264-
265257
bool TargetPlatformIsOpenGL(TargetPlatform platform) {
266258
switch (platform) {
267259
case TargetPlatform::kOpenGLES:

impeller/compiler/types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,5 @@ spv::ExecutionModel ToExecutionModel(SourceType type);
6767
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(
6868
TargetPlatform platform);
6969

70-
std::string ToUtf8(const std::wstring& wstring);
71-
72-
std::string ToUtf8(const std::string& string);
73-
7470
} // namespace compiler
7571
} // namespace impeller

0 commit comments

Comments
 (0)