Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Apply the Windows friendly path solution for remaining ImpellerC paths #37344

Merged
merged 1 commit into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions impeller/compiler/impellerc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion impeller/compiler/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")),
Expand Down
12 changes: 2 additions & 10 deletions impeller/compiler/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <sstream>

#include "flutter/fml/logging.h"
#include "impeller/compiler/utilities.h"

namespace impeller {
namespace compiler {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions impeller/compiler/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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