From b620325cc24fa1d9cc1e3d86e07a759e4033e478 Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Mon, 10 Oct 2022 21:02:45 +0000 Subject: [PATCH 1/2] Stop using u8string which breaks in C++20 --- shell/platform/glfw/flutter_glfw.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index a388d218f1823..ef84e8bbe6358 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -604,7 +604,7 @@ UniqueAotDataPtr LoadAotData(std::filesystem::path aot_data_path) { return nullptr; } if (!std::filesystem::exists(aot_data_path)) { - std::cerr << "Can't load AOT data from " << aot_data_path.u8string() + std::cerr << "Can't load AOT data from " << aot_data_path.string() << "; no such file." << std::endl; return nullptr; } @@ -664,9 +664,8 @@ static bool RunFlutterEngine( std::filesystem::path(executable_location) / aot_library_path; } } - std::string assets_path_string = assets_path.u8string(); - std::string icu_path_string = icu_path.u8string(); - std::string lib_path_string = aot_library_path.u8string(); + auto assets_path_string = assets_path.c_str(); + auto icu_path_string = icu_path.c_str(); // Configure a task runner using the event loop. engine_state->event_loop = std::move(event_loop); @@ -691,15 +690,15 @@ static bool RunFlutterEngine( } FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); - args.assets_path = assets_path_string.c_str(); - args.icu_data_path = icu_path_string.c_str(); + args.assets_path = assets_path_string; + args.icu_data_path = icu_path_string; args.command_line_argc = static_cast(argv.size()); args.command_line_argv = &argv[0]; args.platform_message_callback = EngineOnFlutterPlatformMessage; args.custom_task_runners = &task_runners; if (FlutterEngineRunsAOTCompiledDartCode()) { - engine_state->aot_data = LoadAotData(lib_path_string); + engine_state->aot_data = LoadAotData(aot_library_path); if (!engine_state->aot_data) { std::cerr << "Unable to start engine without AOT data." << std::endl; return false; From 5447fe4541a55650c5e83d89772755164bfe305b Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Fri, 14 Oct 2022 23:04:25 +0000 Subject: [PATCH 2/2] Inline c_str calls --- shell/platform/glfw/flutter_glfw.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index ef84e8bbe6358..50eb69ea70001 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -664,9 +664,6 @@ static bool RunFlutterEngine( std::filesystem::path(executable_location) / aot_library_path; } } - auto assets_path_string = assets_path.c_str(); - auto icu_path_string = icu_path.c_str(); - // Configure a task runner using the event loop. engine_state->event_loop = std::move(event_loop); FlutterTaskRunnerDescription platform_task_runner = {}; @@ -690,8 +687,8 @@ static bool RunFlutterEngine( } FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); - args.assets_path = assets_path_string; - args.icu_data_path = icu_path_string; + args.assets_path = assets_path.c_str(); + args.icu_data_path = icu_path.c_str(); args.command_line_argc = static_cast(argv.size()); args.command_line_argv = &argv[0]; args.platform_message_callback = EngineOnFlutterPlatformMessage;