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

wrap: Add an option to find the runtime relative to a base path


In the SteamLinuxRuntime environment, this could be set to the depot's
base path (the directory containing 'scout' and 'pressure-vessel').

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent ca0a30fa
No related branches found
No related tags found
No related merge requests found
......@@ -56,13 +56,21 @@ class Gui:
self.runtimes = {} # type: typing.Dict[str, str]
for search in (
os.getenv('PRESSURE_VESSEL_RUNTIME_BASE'),
'..',
'../..',
):
if search is None:
continue
source_of_runtimes = os.path.join(
os.path.dirname(sys.argv[0]),
search,
)
if not os.path.isdir(source_of_runtimes):
continue
for member in os.listdir(source_of_runtimes):
path = os.path.realpath(
os.path.join(source_of_runtimes, member)
......
......@@ -34,7 +34,8 @@ me="$(readlink -f "$0")"
here="${me%/*}"
me="${me##*/}"
export PRESSURE_VESSEL_RUNTIME="${here}/../../scout/files"
export PRESSURE_VESSEL_RUNTIME_BASE="${here}/../.."
export PRESSURE_VESSEL_RUNTIME="scout/files"
exec "$here/pressure-vessel-unruntime" "$@"
# vim:set sw=4 sts=4 et:
......@@ -1597,6 +1597,7 @@ static gboolean opt_shell_after = FALSE;
static gboolean opt_shell_fail = FALSE;
static gboolean opt_shell_instead = FALSE;
static GPtrArray *opt_ld_preload = NULL;
static char *opt_runtime_base = NULL;
static char *opt_runtime = NULL;
static gboolean opt_share_home = TRUE;
static gboolean opt_verbose = FALSE;
......@@ -1644,6 +1645,10 @@ static GOptionEntry options[] =
"it with the host system's graphics stack. The empty string "
"means don't use a runtime. [Default: $PRESSURE_VESSEL_RUNTIME or '']",
"RUNTIME" },
{ "runtime-base", 0, 0, G_OPTION_ARG_FILENAME, &opt_runtime_base,
"If a --runtime is a relative path, look for it relative to BASE. "
"[Default: $PRESSURE_VESSEL_RUNTIME_BASE or '.']",
"BASE" },
{ "share-home", 0, 0, G_OPTION_ARG_NONE, &opt_share_home,
"Use the real home directory. [Default]", NULL },
{ "unshare-home", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_share_home,
......@@ -1746,6 +1751,20 @@ main (int argc,
if (opt_runtime == NULL)
opt_runtime = g_strdup (g_getenv ("PRESSURE_VESSEL_RUNTIME"));
if (opt_runtime_base == NULL)
opt_runtime_base = g_strdup (g_getenv ("PRESSURE_VESSEL_RUNTIME_BASE"));
if (opt_runtime != NULL
&& opt_runtime[0] != '\0'
&& !g_path_is_absolute (opt_runtime)
&& opt_runtime_base != NULL
&& opt_runtime_base[0] != '\0')
{
g_autofree gchar *tmp = g_steal_pointer (&opt_runtime);
opt_runtime = g_build_filename (opt_runtime_base, tmp, NULL);
}
if (opt_version)
{
g_print ("pressure-vessel version %s\n", VERSION);
......@@ -2303,6 +2322,7 @@ out:
g_clear_pointer (&opt_steam_app_id, g_free);
g_clear_pointer (&opt_home, g_free);
g_clear_pointer (&opt_fake_home, g_free);
g_clear_pointer (&opt_runtime_base, g_free);
g_clear_pointer (&opt_runtime, g_free);
return ret;
......
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