diff --git a/pressure-vessel-test-ui b/pressure-vessel-test-ui index 3b6ca1534a5b847ce436f8734942bb666cc1ac33..bfe70b22bf4892ed67af19577162a0a96a72adaa 100755 --- a/pressure-vessel-test-ui +++ b/pressure-vessel-test-ui @@ -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) diff --git a/pressure-vessel-unruntime-scout b/pressure-vessel-unruntime-scout index 6aed386ae7003684ab3d70aeef44851989462984..45435502a29a605acfd73edff9fffb6d683c09a9 100755 --- a/pressure-vessel-unruntime-scout +++ b/pressure-vessel-unruntime-scout @@ -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: diff --git a/src/wrap.c b/src/wrap.c index 46347268aaa8b41030fa199c4f11a99bc4ab1450..159b744a942dbd6578e164cff760c0f8e19796eb 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -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;