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

_srt_get_helper: Add support for searching the PATH


We have two broad classes of helper:

- Helpers from this source package, normally found in
  /usr/libexec/steam-runtime-tools-0
- Tools we have repurposed from other source packages (wflinfo and
  vulkaninfo) found via the $PATH

For the former class, our behaviour is unchanged.

To support the latter class, a caller can now set the SEARCH_PATH flag.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 144854d2
No related branches found
No related tags found
1 merge request!77Look for vulkaninfo, wflinfo in SRT_HELPERS_PATH
......@@ -30,6 +30,7 @@
typedef enum
{
SRT_HELPER_FLAGS_SEARCH_PATH = (1 << 0),
SRT_HELPER_FLAGS_TIME_OUT = (1 << 1),
SRT_HELPER_FLAGS_TIME_OUT_SOONER = (1 << 2),
SRT_HELPER_FLAGS_NONE = 0
......
......@@ -237,6 +237,7 @@ _srt_get_helper (const char *helpers_path,
{
GPtrArray *argv = NULL;
gchar *path;
gchar *prefixed;
g_return_val_if_fail (base != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
......@@ -264,6 +265,21 @@ _srt_get_helper (const char *helpers_path,
}
}
if ((flags & SRT_HELPER_FLAGS_SEARCH_PATH) != 0
&& helpers_path == NULL)
{
/* For helpers that are not part of steam-runtime-tools, such as
* *-wflinfo and *-vulkaninfo, we currently only search PATH,
* unless helpers_path has been overridden */
if (multiarch == NULL)
prefixed = g_strdup (base);
else
prefixed = g_strdup_printf ("%s-%s", multiarch, base);
g_ptr_array_add (argv, g_steal_pointer (&prefixed));
return argv;
}
if (helpers_path == NULL)
{
helpers_path = _srt_get_helpers_path (error);
......
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