Apply the Windows friendly path solution in remaining spots (flutter/engine#37344)

This commit is contained in:
Brandon DeRosier
2022-11-05 17:25:23 -07:00
committed by GitHub
parent 0e4c3935c5
commit 128d4ee0c6
4 changed files with 5 additions and 19 deletions

View File

@@ -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<fml::Mapping> sksl_mapping;

View File

@@ -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::UniqueFD>(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", "")),

View File

@@ -8,6 +8,7 @@
#include <sstream>
#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<std::codecvt_utf8<wchar_t>> myconv;
return myconv.to_bytes(wstring);
}
std::string ToUtf8(const std::string& string) {
return string;
}
bool TargetPlatformIsOpenGL(TargetPlatform platform) {
switch (platform) {
case TargetPlatform::kOpenGLES:

View File

@@ -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