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

system-info: Look for expectations in /usr/lib/steamrt by default

parent 7a8e2c01
Branches
Tags
1 merge request!32Auto-detect path to expectations
...@@ -75,6 +75,7 @@ struct _SrtSystemInfo ...@@ -75,6 +75,7 @@ struct _SrtSystemInfo
{ {
/*< private >*/ /*< private >*/
GObject parent; GObject parent;
/* "" if we have tried and failed to auto-detect */
gchar *expectations; gchar *expectations;
Tristate can_write_uinput; Tristate can_write_uinput;
/* (element-type Abi) */ /* (element-type Abi) */
...@@ -347,6 +348,34 @@ library_compare (SrtLibrary *a, SrtLibrary *b) ...@@ -347,6 +348,34 @@ library_compare (SrtLibrary *a, SrtLibrary *b)
return g_strcmp0 (srt_library_get_soname (a), srt_library_get_soname (b)); return g_strcmp0 (srt_library_get_soname (a), srt_library_get_soname (b));
} }
static gboolean
ensure_expectations (SrtSystemInfo *self)
{
if (self->expectations == NULL)
{
const char *runtime;
const char *sysroot = "/";
gchar *def;
runtime = g_getenv ("STEAM_RUNTIME");
if (runtime != NULL && runtime[0] == '/')
sysroot = runtime;
def = g_build_filename (sysroot, "usr", "lib", "steamrt",
"expectations", NULL);
if (g_file_test (def, G_FILE_TEST_IS_DIR))
self->expectations = g_steal_pointer (&def);
else
self->expectations = g_strdup ("");
g_free (def);
}
return self->expectations[0] != '\0';
}
/** /**
* srt_system_info_check_libraries: * srt_system_info_check_libraries:
* @self: The #SrtSystemInfo object to use. * @self: The #SrtSystemInfo object to use.
...@@ -384,7 +413,7 @@ srt_system_info_check_libraries (SrtSystemInfo *self, ...@@ -384,7 +413,7 @@ srt_system_info_check_libraries (SrtSystemInfo *self,
g_return_val_if_fail (libraries_out == NULL || *libraries_out == NULL, g_return_val_if_fail (libraries_out == NULL || *libraries_out == NULL,
SRT_LIBRARY_ISSUES_INTERNAL_ERROR); SRT_LIBRARY_ISSUES_INTERNAL_ERROR);
if (self->expectations == NULL) if (!ensure_expectations (self))
{ {
/* We don't know which libraries to check. */ /* We don't know which libraries to check. */
return SRT_LIBRARY_ISSUES_UNKNOWN_EXPECTATIONS; return SRT_LIBRARY_ISSUES_UNKNOWN_EXPECTATIONS;
...@@ -538,7 +567,7 @@ srt_system_info_check_library (SrtSystemInfo *self, ...@@ -538,7 +567,7 @@ srt_system_info_check_library (SrtSystemInfo *self,
return srt_library_get_issues (library); return srt_library_get_issues (library);
} }
if (self->expectations != NULL) if (ensure_expectations (self))
{ {
dir_path = g_build_filename (self->expectations, multiarch_tuple, NULL); dir_path = g_build_filename (self->expectations, multiarch_tuple, NULL);
dir = g_dir_open (dir_path, 0, &error); dir = g_dir_open (dir_path, 0, &error);
......
...@@ -623,9 +623,9 @@ wrong_expectations (Fixture *f, ...@@ -623,9 +623,9 @@ wrong_expectations (Fixture *f,
return; return;
} }
/* Set the expectations folder to NULL. /* Set the expectations folder to one that does not contain the
* We expect the library checks to fail. */ * necessary files. We expect the library checks to fail. */
info = srt_system_info_new (NULL); info = srt_system_info_new ("/dev");
issues = srt_system_info_check_libraries (info, issues = srt_system_info_check_libraries (info,
_SRT_MULTIARCH, _SRT_MULTIARCH,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment