forked from firka/flutter
[linux] Allow overriding asset, ICU data path (flutter/engine#38296)
Support setting a custom asset directory and ICU data path. Fixes: https://github.com/flutter/flutter/issues/117103 Issue: https://github.com/flutter/flutter/issues/117102
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user