From b3584f5142e417b1ed7d91d2a8c84ac78c2beb0a Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Sat, 5 Nov 2022 00:58:56 -0700 Subject: [PATCH] Apply the Windows friendly path solution in remaining spots --- impeller/compiler/impellerc_main.cc | 6 ++---- impeller/compiler/switches.cc | 2 +- impeller/compiler/types.cc | 12 ++---------- impeller/compiler/types.h | 4 ---- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/impeller/compiler/impellerc_main.cc b/impeller/compiler/impellerc_main.cc index b73a72b8fca47..e6a7e9a44ac95 100644 --- a/impeller/compiler/impellerc_main.cc +++ b/impeller/compiler/impellerc_main.cc @@ -77,10 +77,8 @@ bool Main(const fml::CommandLine& command_line) { reflector_options.entry_point_name = options.entry_point_name; reflector_options.shader_name = InferShaderNameFromPath(switches.source_file_name); - reflector_options.header_file_name = - ToUtf8(std::filesystem::path{switches.reflection_header_name} - .filename() - .native()); + reflector_options.header_file_name = Utf8FromPath( + std::filesystem::path{switches.reflection_header_name}.filename()); // Generate SkSL if needed. std::shared_ptr sksl_mapping; diff --git a/impeller/compiler/switches.cc b/impeller/compiler/switches.cc index 29ef80c19cf39..4ca2a27d5c5e2 100644 --- a/impeller/compiler/switches.cc +++ b/impeller/compiler/switches.cc @@ -100,7 +100,7 @@ static SourceType SourceTypeFromCommandLine( Switches::Switches(const fml::CommandLine& command_line) : target_platform(TargetPlatformFromCommandLine(command_line)), working_directory(std::make_shared(fml::OpenDirectory( - ToUtf8(std::filesystem::current_path().native()).c_str(), + Utf8FromPath(std::filesystem::current_path()).c_str(), false, // create if necessary, fml::FilePermission::kRead))), source_file_name(command_line.GetOptionValueWithDefault("input", "")), diff --git a/impeller/compiler/types.cc b/impeller/compiler/types.cc index b7e13e5aba49b..cf1dae31a126e 100644 --- a/impeller/compiler/types.cc +++ b/impeller/compiler/types.cc @@ -8,6 +8,7 @@ #include #include "flutter/fml/logging.h" +#include "impeller/compiler/utilities.h" namespace impeller { namespace compiler { @@ -77,7 +78,7 @@ std::string EntryPointFunctionNameFromSourceName(const std::string& file_name, SourceType type) { std::stringstream stream; std::filesystem::path file_path(file_name); - stream << ToUtf8(file_path.stem().native()) << "_"; + stream << Utf8FromPath(file_path.stem()) << "_"; switch (type) { case SourceType::kUnknown: stream << "unknown"; @@ -253,15 +254,6 @@ std::string TargetPlatformSLExtension(TargetPlatform platform) { FML_UNREACHABLE(); } -std::string ToUtf8(const std::wstring& wstring) { - std::wstring_convert> myconv; - return myconv.to_bytes(wstring); -} - -std::string ToUtf8(const std::string& string) { - return string; -} - bool TargetPlatformIsOpenGL(TargetPlatform platform) { switch (platform) { case TargetPlatform::kOpenGLES: diff --git a/impeller/compiler/types.h b/impeller/compiler/types.h index dd274cf6d6d3b..754f2020f5f40 100644 --- a/impeller/compiler/types.h +++ b/impeller/compiler/types.h @@ -67,9 +67,5 @@ spv::ExecutionModel ToExecutionModel(SourceType type); spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform( TargetPlatform platform); -std::string ToUtf8(const std::wstring& wstring); - -std::string ToUtf8(const std::string& string); - } // namespace compiler } // namespace impeller