[retro-gtk] retro-runner: Override the runner path from environment
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-runner: Override the runner path from environment
- Date: Fri, 16 Apr 2021 20:42:13 +0000 (UTC)
commit 74600b3dc275b1d90575f53292c917d154264fec
Author: Christopher Obbard <chris obbard collabora com>
Date: Wed Apr 14 09:23:44 2021 +0100
retro-runner: Override the runner path from environment
Allow the runner path to be set using RETRO_RUNNER environment
variable; but falling back to the default installation path
set by the Meson installation script.
Signed-off-by: Christopher Obbard <chris obbard collabora com>
retro-gtk/retro-runner-process.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/retro-gtk/retro-runner-process.c b/retro-gtk/retro-runner-process.c
index 490ddcb..7a0f0cd 100644
--- a/retro-gtk/retro-runner-process.c
+++ b/retro-gtk/retro-runner-process.c
@@ -219,6 +219,20 @@ create_connection (GSubprocessLauncher *launcher,
return connection;
}
+static gchar *
+get_runner_path (void)
+{
+ g_auto(GStrv) envp = NULL;
+ const gchar *runner_path;
+
+ envp = g_get_environ ();
+ runner_path = g_environ_getenv (envp, "RETRO_RUNNER");
+ if (runner_path)
+ return g_strdup (runner_path);
+
+ return g_strdup (RETRO_RUNNER_PATH);
+}
+
/**
* retro_runner_process_start:
* @self: a #RetroRunnerProcess
@@ -233,6 +247,7 @@ retro_runner_process_start (RetroRunnerProcess *self,
{
g_autoptr(GSocketConnection) connection = NULL;
g_autoptr(GSubprocessLauncher) launcher = NULL;
+ g_autofree gchar *runner_path = NULL;
g_autoptr(GSubprocess) process = NULL;
g_return_if_fail (RETRO_IS_RUNNER_PROCESS (self));
@@ -243,9 +258,11 @@ retro_runner_process_start (RetroRunnerProcess *self,
if (!(connection = create_connection (launcher, 3, error)))
return;
+ runner_path = get_runner_path ();
+
retro_try_propagate ({
process = g_subprocess_launcher_spawn (launcher, &catch,
- RETRO_RUNNER_PATH,
+ runner_path,
g_get_application_name (),
self->filename, NULL);
}, catch, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]