Skip to content

Commit

Permalink
[ci skip] Fix launching for flatpak
Browse files Browse the repository at this point in the history
Former-commit-id: 732aad7
  • Loading branch information
tkashkin committed Jul 15, 2018
1 parent ffafae3 commit b481abe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
7 changes: 6 additions & 1 deletion src/launcher.sh.in
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ RUNTIME=@RUNTIME@

if [[ ! -z "$RUNTIME" ]]; then
echo "Runtime path: $RUNTIME"
export LD_LIBRARY_PATH=$RUNTIME:$LD_LIBRARY_PATH

if [[ ! -z "$LD_LIBRARY_PATH" ]]; then
RUNTIME=$RUNTIME:$LD_LIBRARY_PATH
fi

export LD_LIBRARY_PATH=$RUNTIME
fi

exec "$@"
25 changes: 10 additions & 15 deletions src/utils/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ namespace GameHub.Utils
var cenv = Environ.get();
var ccmd = cmd;

if(use_launcher_script)
{
var arr = new GLib.Array<string>(false);
arr.append_val(ProjectConfig.PROJECT_NAME + ".launcher");
arr.append_vals(cmd, cmd.length);
ccmd = (owned) arr.data;
}
#if FLATPAK
cenv = Environ.set_variable(cenv, "LD_LIBRARY_PATH", "/app/lib/steamrt:/app/lib/32bit/steamrt");
#endif

try
{
Expand All @@ -54,30 +50,29 @@ namespace GameHub.Utils
var cdir = dir ?? Environment.get_home_dir();
var cenv = Environ.get();
var ccmd = cmd;
var cwait = wait;

if(use_launcher_script)
{
var arr = new GLib.Array<string>(false);
arr.append_val(ProjectConfig.PROJECT_NAME + ".launcher");
arr.append_vals(cmd, cmd.length);
ccmd = (owned) arr.data;
}
#if FLATPAK
cenv = Environ.set_variable(cenv, "LD_LIBRARY_PATH", "/app/lib/steamrt:/app/lib/32bit/steamrt");
#endif

try
{
Process.spawn_async(cdir, ccmd, cenv, SpawnFlags.SEARCH_PATH | SpawnFlags.STDERR_TO_DEV_NULL, null, out pid);

#if !FLATPAK
ChildWatch.add(pid, (pid, status) => {
Process.close_pid(pid);
run_async.callback();
});
#endif
}
catch (Error e)
{
warning(e.message);
}

if(wait) yield;
if(cwait) yield;

return result;
}
Expand Down

0 comments on commit b481abe

Please sign in to comment.