Skip to content

Commit

Permalink
icon-validator: Allow custom path for icon validator via env
Browse files Browse the repository at this point in the history
This allows setting a custom path for the icon validator, especially
useful when testing without installing.
  • Loading branch information
jsparber committed Apr 4, 2024
1 parent 832ee46 commit 730c5db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ if bwrap.found()
validate_icon_c_args += '-DHELPER="@0@"'.format(bwrap.full_path())
endif

executable(

xdp_validate_icon = executable(
'xdg-desktop-portal-validate-icon',
'validate-icon.c',
dependencies: [gdk_pixbuf_dep],
Expand Down
3 changes: 3 additions & 0 deletions src/xdp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,9 @@ xdp_validate_serialized_icon (GVariant *v,
return FALSE;
}

if (g_getenv ("XDP_VALIDATE_ICON"))
icon_validator = g_getenv ("XDP_VALIDATE_ICON");

if (!g_file_test (icon_validator, G_FILE_TEST_EXISTS))
{
g_warning ("Icon validation: %s not found, rejecting icon by default.", icon_validator);
Expand Down
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
env_tests = environment()
env_tests.set('XDP_UNINSTALLED', '1')
env_tests.set('XDG_DATA_DIRS', meson.current_build_dir() / 'share')
env_tests.set('XDP_VALIDATE_ICON', xdp_validate_icon.full_path())
env_tests.set('G_TEST_SRCDIR', meson.current_source_dir())
env_tests.set('G_TEST_BUILDDIR', meson.current_build_dir())
env_tests.set('G_DEBUG', 'gc-friendly') # from glib-tap.mk
Expand Down

0 comments on commit 730c5db

Please sign in to comment.