From d47ae7db73b12c1070b2d1b7bc1cd8845383491f Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 28 Nov 2022 18:24:04 -0800 Subject: [PATCH] [impellerc] speculative fix for include errors with impellerc shader lib (flutter/engine#37939) * [impellerc] specualtive fix for include errors * ++ * ++ --- engine/src/flutter/impeller/compiler/switches.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/impeller/compiler/switches.cc b/engine/src/flutter/impeller/compiler/switches.cc index 348b6eac31..7618b0ed0a 100644 --- a/engine/src/flutter/impeller/compiler/switches.cc +++ b/engine/src/flutter/impeller/compiler/switches.cc @@ -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::OpenDirectoryReadOnly( *working_directory, include_dir_absolute.string().c_str()));