[impellerc] speculative fix for include errors with impellerc shader lib (flutter/engine#37939)

* [impellerc] specualtive fix for include errors

* ++

* ++
This commit is contained in:
Jonah Williams
2022-11-28 18:24:04 -08:00
committed by GitHub
parent 55fa35bcc8
commit d47ae7db73

View File

@@ -156,9 +156,14 @@ Switches::Switches(const fml::CommandLine& command_line)
// Note that the `include_dir_path` is already utf8 encoded, and so we
// mustn't attempt to double-convert it to utf8 lest multi-byte characters
// will become mangled.
auto cwd = Utf8FromPath(std::filesystem::current_path());
auto include_dir_absolute = std::filesystem::absolute(
std::filesystem::path(cwd) / include_dir_path);
std::filesystem::path include_dir_absolute;
if (std::filesystem::path(include_dir_path).is_absolute()) {
include_dir_absolute = std::filesystem::path(include_dir_path);
} else {
auto cwd = Utf8FromPath(std::filesystem::current_path());
include_dir_absolute = std::filesystem::absolute(
std::filesystem::path(cwd) / include_dir_path);
}
auto dir = std::make_shared<fml::UniqueFD>(fml::OpenDirectoryReadOnly(
*working_directory, include_dir_absolute.string().c_str()));