lib/wp: Fix lookup_dirs with WP_LOOKUP_DIR_ENV_DATA or WP_LOOKUP_DIR_ENV_TEST_SRCDIR

Fixes: aa2f7e9f308f ("lib/wp: add a new search folder to locate the Lua Test scripts")
This commit is contained in:
Torge Matthies
2023-03-09 12:49:08 +01:00
committed by Julian Bouzas
parent c61d1e4245
commit ab6a3393e6

View File

@@ -135,8 +135,9 @@ lookup_dirs (guint flags)
if ((flags & WP_LOOKUP_DIR_ENV_CONFIG) && if ((flags & WP_LOOKUP_DIR_ENV_CONFIG) &&
(dir = g_getenv ("WIREPLUMBER_CONFIG_DIR"))) { (dir = g_getenv ("WIREPLUMBER_CONFIG_DIR"))) {
g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL)); g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL));
goto done;
} }
else if (flags & (WP_LOOKUP_DIR_ENV_DATA | WP_LOOKUP_DIR_ENV_TEST_SRCDIR)) { if (flags & (WP_LOOKUP_DIR_ENV_DATA | WP_LOOKUP_DIR_ENV_TEST_SRCDIR)) {
if ((flags & WP_LOOKUP_DIR_ENV_DATA) && if ((flags & WP_LOOKUP_DIR_ENV_DATA) &&
(dir = g_getenv ("WIREPLUMBER_DATA_DIR"))) (dir = g_getenv ("WIREPLUMBER_DATA_DIR")))
g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL)); g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL));
@@ -144,20 +145,22 @@ lookup_dirs (guint flags)
if ((flags & WP_LOOKUP_DIR_ENV_TEST_SRCDIR) && if ((flags & WP_LOOKUP_DIR_ENV_TEST_SRCDIR) &&
(dir = g_getenv ("G_TEST_SRCDIR"))) (dir = g_getenv ("G_TEST_SRCDIR")))
g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL)); g_ptr_array_add (dirs, g_canonicalize_filename (dir, NULL));
}
else {
if (flags & WP_LOOKUP_DIR_XDG_CONFIG_HOME) {
dir = g_get_user_config_dir ();
g_ptr_array_add (dirs, g_build_filename (dir, "pipewire", NULL));
}
if (flags & WP_LOOKUP_DIR_ETC)
g_ptr_array_add (dirs,
g_canonicalize_filename (WIREPLUMBER_DEFAULT_CONFIG_DIR, NULL));
if (flags & WP_LOOKUP_DIR_PREFIX_SHARE)
g_ptr_array_add (dirs,
g_canonicalize_filename(WIREPLUMBER_DEFAULT_DATA_DIR, NULL));
}
if (dirs->len)
goto done;
}
if (flags & WP_LOOKUP_DIR_XDG_CONFIG_HOME) {
dir = g_get_user_config_dir ();
g_ptr_array_add (dirs, g_build_filename (dir, "pipewire", NULL));
}
if (flags & WP_LOOKUP_DIR_ETC)
g_ptr_array_add (dirs,
g_canonicalize_filename (WIREPLUMBER_DEFAULT_CONFIG_DIR, NULL));
if (flags & WP_LOOKUP_DIR_PREFIX_SHARE)
g_ptr_array_add (dirs,
g_canonicalize_filename(WIREPLUMBER_DEFAULT_DATA_DIR, NULL));
done:
return g_steal_pointer (&dirs); return g_steal_pointer (&dirs);
} }