Commit f251acc1 authored by Christian Hergert's avatar Christian Hergert
Browse files

flatpak: add helper to resolve app paths

We might need to find the path on the host, so add a helper to join paths
to get access to the file on the host.
parent 28f7db9c
......@@ -44,3 +44,25 @@ ide_is_flatpak (void)
return is_flatpak;
}
static gchar *
get_base_path (const gchar *name)
{
g_autoptr(GKeyFile) keyfile = g_key_file_new ();
if (g_key_file_load_from_file (keyfile, "/.flatpak-info", 0, NULL))
return g_key_file_get_string (keyfile, "Instance", name, NULL);
return NULL;
}
gchar *
ide_flatpak_get_app_path (const gchar *path)
{
static gchar *base_path;
if (base_path == NULL)
base_path = get_base_path ("app-path");
return g_build_filename (base_path, path, NULL);
}
......@@ -23,7 +23,8 @@
G_BEGIN_DECLS
gboolean ide_is_flatpak (void);
gboolean ide_is_flatpak (void);
gchar *ide_flatpak_get_app_path (const gchar *path);
G_END_DECLS
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment