diff --git a/bin/system-info.c b/bin/system-info.c index 903dde23ed6a9a4c2f8ec63e1fafcf8bc8442f94..de092fc91f5383ccabe2ea55b63d2357f01ba791 100644 --- a/bin/system-info.c +++ b/bin/system-info.c @@ -808,6 +808,7 @@ main (int argc, gchar *version = NULL; gchar *inst_path = NULL; gchar *data_path = NULL; + gchar *bin32_path = NULL; gchar *rt_path = NULL; gchar **overrides = NULL; gchar **messages = NULL; @@ -891,6 +892,9 @@ main (int argc, json_builder_set_member_name (builder, "data_path"); data_path = srt_system_info_dup_steam_data_path (info); json_builder_add_string_value (builder, data_path); + json_builder_set_member_name (builder, "bin32_path"); + bin32_path = srt_system_info_dup_steam_bin32_path (info); + json_builder_add_string_value (builder, bin32_path); json_builder_set_member_name (builder, "issues"); json_builder_begin_array (builder); steam_issues = srt_system_info_get_steam_issues (info); @@ -1299,6 +1303,7 @@ main (int argc, json_node_free (root); g_object_unref (builder); g_object_unref (info); + g_free (bin32_path); g_free (rt_path); g_free (data_path); g_free (inst_path); diff --git a/bin/system-info.md b/bin/system-info.md index c0ee32e986c3e193084f379e69a961408b1b10e7..b921f4b18df9d55562ef4d8b21b43f939b2a792e 100644 --- a/bin/system-info.md +++ b/bin/system-info.md @@ -51,6 +51,12 @@ keys: This is usually the same as **path** but can differ under some circumstances. + **bin32_path** + : A string: the absolute path to the Steam "ubuntu12_32" directory, + typically containing **steam-runtime** among others. + This is usually a direct subdirectory of **path** but can differ under + some circumstances. + **issues** : An array of strings representing problems with the Steam installation. If empty, no problems were found. diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c index 93b4c7f011eb1cde717b8a56a0da153cf8246f20..749d6899c0e70fe31afbfddcc4b9e8fa2dd4742b 100644 --- a/steam-runtime-tools/system-info.c +++ b/steam-runtime-tools/system-info.c @@ -1770,6 +1770,32 @@ srt_system_info_dup_steam_data_path (SrtSystemInfo *self) return g_strdup (srt_steam_get_data_path (self->steam_data)); } +/** + * srt_system_info_dup_steam_bin32_path: + * @self: The #SrtSystemInfo object + * + * Return the absolute path to the Steam `ubuntu12_32` directory in use + * (the directory containing `steam-runtime/` among other files and + * directories). + * + * Under normal circumstances, this is a `ubuntu12_32` direct subdirectory + * under the srt_system_info_dup_steam_installation_path(). + * Typically of the form `/home/me/.local/share/Steam/ubuntu12_32`. + * It is canonically accessed via the symbolic link `~/.steam/bin32`. + * + * Returns: (transfer full) (type filename) (nullable): The absolute path + * to the Steam `ubuntu12_32` directory, or %NULL if it could not be + * determined. Free with g_free(). + */ +gchar * +srt_system_info_dup_steam_bin32_path (SrtSystemInfo *self) +{ + g_return_val_if_fail (SRT_IS_SYSTEM_INFO (self), NULL); + + ensure_steam_cached (self); + return g_strdup (srt_steam_get_bin32_path (self->steam_data)); +} + static void ensure_os_cached (SrtSystemInfo *self) { diff --git a/steam-runtime-tools/system-info.h b/steam-runtime-tools/system-info.h index 08ecca115be109d3272339415ca364b986d8bd26..cb3717b90f4176d3b20b76feec82cc3152392ae2 100644 --- a/steam-runtime-tools/system-info.h +++ b/steam-runtime-tools/system-info.h @@ -169,6 +169,7 @@ SrtSteamIssues srt_system_info_get_steam_issues (SrtSystemInfo *self); SrtSteam *srt_system_info_get_steam_details (SrtSystemInfo *self); gchar *srt_system_info_dup_steam_installation_path (SrtSystemInfo *self); gchar *srt_system_info_dup_steam_data_path (SrtSystemInfo *self); +gchar *srt_system_info_dup_steam_bin32_path (SrtSystemInfo *self); gchar ** srt_system_info_list_pressure_vessel_overrides (SrtSystemInfo *self, gchar ***messages); diff --git a/tests/fake-home.c b/tests/fake-home.c index 7bb855b9e9e651871821fc49598f8b6aac2b5720..a1f59352e65623ae9a3c1cc2e6932f42516be6a7 100644 --- a/tests/fake-home.c +++ b/tests/fake-home.c @@ -106,7 +106,6 @@ fake_home_create_structure (FakeHome *f) gchar *local_share = NULL; gchar *ld_path = NULL; gchar *prepended_path = NULL; - gchar *ubuntu12_32 = NULL; gchar *app_home = NULL; gchar *data_name = NULL; GError *error = NULL; @@ -156,8 +155,9 @@ const gchar *mime_cache = f->steam_data = g_strdup (f->steam_install); } - f->runtime = g_build_filename (f->steam_install, "ubuntu12_32", - "steam-runtime", NULL); + f->ubuntu12_32 = g_build_filename (f->steam_install, "ubuntu12_32", NULL); + + f->runtime = g_build_filename (f->ubuntu12_32, "steam-runtime", NULL); scripts = g_build_filename (f->runtime, "scripts", NULL); @@ -249,8 +249,7 @@ const gchar *mime_cache = dot_steam_bin32 = g_build_filename (dot_steam, "bin32", NULL); symlink_gfile = g_file_new_for_path (dot_steam_bin32); - ubuntu12_32 = g_build_filename (f->steam_install, "ubuntu12_32", NULL); - g_file_make_symbolic_link (symlink_gfile, ubuntu12_32, NULL, &error); + g_file_make_symbolic_link (symlink_gfile, f->ubuntu12_32, NULL, &error); g_object_unref (symlink_gfile); g_assert_no_error (error); } @@ -355,7 +354,6 @@ const gchar *mime_cache = g_free (local_share); g_free (ld_path); g_free (prepended_path); - g_free (ubuntu12_32); g_free (app_home); g_free (data_name); @@ -382,6 +380,7 @@ fake_home_clean_up (FakeHome *f) g_free (f->home); g_free (f->steam_data); g_free (f->steam_install); + g_free (f->ubuntu12_32); g_free (f->runtime); g_free (f->pinned_32); g_free (f->pinned_64); diff --git a/tests/fake-home.h b/tests/fake-home.h index 2c74f07a2a328c5b0e7311c6075dd869eb00e090..58e3bb5a4bb4dc10c03cb8e0985de1aae8d8b77d 100644 --- a/tests/fake-home.h +++ b/tests/fake-home.h @@ -46,6 +46,7 @@ typedef struct gchar *home; gchar *steam_install; gchar *steam_data; + gchar *ubuntu12_32; gchar *runtime; gchar *pinned_32; gchar *pinned_64; diff --git a/tests/system-info.c b/tests/system-info.c index 02196391ee1070f92b59930363840310c4a23355..d894b517ee7d0fce6fca1fd03c8d4b0828b2d7f9 100644 --- a/tests/system-info.c +++ b/tests/system-info.c @@ -740,6 +740,7 @@ steam_runtime (Fixture *f, SrtSteam *steam_details; gchar *runtime_path = NULL; gchar *installation_path = NULL; + gchar *bin32_path = NULL; FakeHome *fake_home; fake_home = fake_home_new (fake_home_path); @@ -755,8 +756,11 @@ steam_runtime (Fixture *f, g_assert_cmpstr (runtime_path, ==, fake_home->runtime); installation_path = srt_system_info_dup_steam_installation_path (info); g_assert_cmpstr (installation_path, ==, fake_home->steam_install); + bin32_path = srt_system_info_dup_steam_bin32_path (info); + g_assert_cmpstr (bin32_path, ==, fake_home->ubuntu12_32); g_free (runtime_path); g_free (installation_path); + g_free (bin32_path); /* Do the check again, this time using the cache */ runtime_issues = srt_system_info_get_runtime_issues (info); @@ -765,6 +769,8 @@ steam_runtime (Fixture *f, g_assert_cmpstr (runtime_path, ==, fake_home->runtime); installation_path = srt_system_info_dup_steam_installation_path (info); g_assert_cmpstr (installation_path, ==, fake_home->steam_install); + bin32_path = srt_system_info_dup_steam_bin32_path (info); + g_assert_cmpstr (bin32_path, ==, fake_home->ubuntu12_32); /* Check for Steam issues */ steam_issues = srt_system_info_get_steam_issues (info); @@ -786,6 +792,7 @@ steam_runtime (Fixture *f, g_object_unref (steam_details); g_free (runtime_path); g_free (installation_path); + g_free (bin32_path); } static void