Skip to content
Snippets Groups Projects
Commit 941bd627 authored by Simon McVittie's avatar Simon McVittie
Browse files

graphics: Canonicalize relative filenames before prepending sysroot


Otherwise we'll treat them as relative to `/` instead of the current
working directory, which breaks some of the tests when we move to
always using a non-NULL sysroot (that is sometimes `/`).

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent dd2ccaae
No related branches found
No related tags found
1 merge request!139Move resolve-in-sysroot into the shared library
......@@ -1761,6 +1761,7 @@ load_json_dir (const char *sysroot,
{
g_autoptr(GError) error = NULL;
g_autoptr(GDir) dir_iter = NULL;
g_autofree gchar *canon = NULL;
g_autofree gchar *sysrooted_dir = NULL;
g_autofree gchar *suffixed_dir = NULL;
const char *iter_dir;
......@@ -1773,6 +1774,12 @@ load_json_dir (const char *sysroot,
if (dir == NULL)
return;
if (!g_path_is_absolute (dir))
{
canon = g_canonicalize_filename (dir, NULL);
dir = canon;
}
if (suffix != NULL)
{
suffixed_dir = g_build_filename (dir, suffix, NULL);
......@@ -2336,11 +2343,18 @@ egl_icd_load_json (const char *sysroot,
GList **list)
{
g_autoptr(GError) error = NULL;
g_autofree gchar *canon = NULL;
g_autofree gchar *in_sysroot = NULL;
g_autofree gchar *library_path = NULL;
g_return_if_fail (list != NULL);
if (!g_path_is_absolute (filename))
{
canon = g_canonicalize_filename (filename, NULL);
filename = canon;
}
if (sysroot != NULL)
in_sysroot = g_build_filename (sysroot, filename, NULL);
......@@ -4761,12 +4775,19 @@ vulkan_icd_load_json (const char *sysroot,
GList **list)
{
g_autoptr(GError) error = NULL;
g_autofree gchar *canon = NULL;
g_autofree gchar *in_sysroot = NULL;
g_autofree gchar *api_version = NULL;
g_autofree gchar *library_path = NULL;
g_return_if_fail (list != NULL);
if (!g_path_is_absolute (filename))
{
canon = g_canonicalize_filename (filename, NULL);
filename = canon;
}
if (sysroot != NULL)
in_sysroot = g_build_filename (sysroot, filename, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment