Skip to content
Snippets Groups Projects
Commit e15e6206 authored by Ludovico de Nittis's avatar Ludovico de Nittis :palm_tree:
Browse files

Add a function to return the absolute path to "ubuntu12_32" directory


We already stored the path to "ubuntu12_32" but this information was
kept private. Now we give a public function to access it and we also
show this information in the JSON output.

Signed-off-by: default avatarLudovico de Nittis <ludovico.denittis@collabora.com>
parent 8234ea56
No related branches found
No related tags found
1 merge request!124Add a function to return the absolute path to "ubuntu12_32" directory
Pipeline #3026 passed
This commit is part of merge request !124. Comments created here will be created in the context of that merge request.
......@@ -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);
......
......@@ -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.
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment