diff --git a/shell/platform/linux/fl_dart_project.cc b/shell/platform/linux/fl_dart_project.cc index 3a8de3fa571f9..fb749d3d8c03b 100644 --- a/shell/platform/linux/fl_dart_project.cc +++ b/shell/platform/linux/fl_dart_project.cc @@ -88,12 +88,26 @@ G_MODULE_EXPORT const gchar* fl_dart_project_get_aot_library_path( return self->aot_library_path; } +G_MODULE_EXPORT void fl_dart_project_set_assets_path(FlDartProject* self, + gchar* path) { + g_return_if_fail(FL_IS_DART_PROJECT(self)); + g_clear_pointer(&self->assets_path, g_free); + self->assets_path = g_strdup(path); +} + G_MODULE_EXPORT const gchar* fl_dart_project_get_assets_path( FlDartProject* self) { g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr); return self->assets_path; } +G_MODULE_EXPORT void fl_dart_project_set_icu_data_path(FlDartProject* self, + gchar* path) { + g_return_if_fail(FL_IS_DART_PROJECT(self)); + g_clear_pointer(&self->icu_data_path, g_free); + self->icu_data_path = g_strdup(path); +} + G_MODULE_EXPORT const gchar* fl_dart_project_get_icu_data_path( FlDartProject* self) { g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr); diff --git a/shell/platform/linux/fl_dart_project_test.cc b/shell/platform/linux/fl_dart_project_test.cc index 7b37ced42a57d..03a16f560cbfc 100644 --- a/shell/platform/linux/fl_dart_project_test.cc +++ b/shell/platform/linux/fl_dart_project_test.cc @@ -38,6 +38,22 @@ TEST(FlDartProjectTest, EnableMirrors) { G_GNUC_END_IGNORE_DEPRECATIONS } +TEST(FlDartProjectTest, OverrideAssetsPath) { + g_autoptr(FlDartProject) project = fl_dart_project_new(); + + char assets_path[] = "/normal/tuesday/night/for/shia/labeouf"; + fl_dart_project_set_assets_path(project, assets_path); + EXPECT_STREQ(fl_dart_project_get_assets_path(project), assets_path); +} + +TEST(FlDartProjectTest, OverrideIcuDataPath) { + g_autoptr(FlDartProject) project = fl_dart_project_new(); + + char icu_data_path[] = "/living/in/the/woods/icudtl.dat"; + fl_dart_project_set_icu_data_path(project, icu_data_path); + EXPECT_STREQ(fl_dart_project_get_icu_data_path(project), icu_data_path); +} + TEST(FlDartProjectTest, DartEntrypointArgs) { g_autoptr(FlDartProject) project = fl_dart_project_new(); diff --git a/shell/platform/linux/public/flutter_linux/fl_dart_project.h b/shell/platform/linux/public/flutter_linux/fl_dart_project.h index 1b56e24c32627..d54b8b790e83c 100644 --- a/shell/platform/linux/public/flutter_linux/fl_dart_project.h +++ b/shell/platform/linux/public/flutter_linux/fl_dart_project.h @@ -73,6 +73,17 @@ gboolean fl_dart_project_get_enable_mirrors(FlDartProject* project) */ const gchar* fl_dart_project_get_aot_library_path(FlDartProject* project); +/** + * fl_dart_project_set_assets_path: + * @project: an #FlDartProject. + * @path: the absolute path to the assets directory. + * + * Sets the path to the directory containing the assets used in the Flutter + * application. By default, this is the data/flutter_assets subdirectory + * relative to the executable directory. + */ +void fl_dart_project_set_assets_path(FlDartProject* project, gchar* path); + /** * fl_dart_project_get_assets_path: * @project: an #FlDartProject. @@ -85,6 +96,16 @@ const gchar* fl_dart_project_get_aot_library_path(FlDartProject* project); */ const gchar* fl_dart_project_get_assets_path(FlDartProject* project); +/** + * fl_dart_project_set_icu_data_path: + * @project: an #FlDartProject. + * @path: the absolute path to the ICU data file. + * + * Sets the path to the ICU data file used in the Flutter application. By + * default, this is data/icudtl.dat relative to the executable directory. + */ +void fl_dart_project_set_icu_data_path(FlDartProject* project, gchar* path); + /** * fl_dart_project_get_icu_data_path: * @project: an #FlDartProject.