mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
Allow AppImage to spawn its own rpcs3 process for fatal error dialog (Linux)
This commit is contained in:
parent
7c972c8860
commit
39796141fc
1 changed files with 19 additions and 2 deletions
|
@ -26,6 +26,8 @@ DYNAMIC_IMPORT("ntdll.dll", NtSetTimerResolution, NTSTATUS(ULONG DesiredResoluti
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -129,9 +131,24 @@ LOG_CHANNEL(sys_log, "SYS");
|
||||||
#else
|
#else
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
std::vector<char> data(text.data(), text.data() + text.size() + 1);
|
std::vector<char> data(text.data(), text.data() + text.size() + 1);
|
||||||
|
std::string run_arg = +s_argv0;
|
||||||
std::string err_arg = "--error";
|
std::string err_arg = "--error";
|
||||||
char* argv[] = {+s_argv0, err_arg.data(), data.data(), nullptr};
|
|
||||||
int ret = posix_spawn(&pid, +s_argv0, nullptr, nullptr, argv, environ);
|
if (run_arg.find_first_of('/') == umax)
|
||||||
|
{
|
||||||
|
// AppImage has "rpcs3" in argv[0], can't just execute it
|
||||||
|
#ifdef __linux__
|
||||||
|
char buffer[PATH_MAX]{};
|
||||||
|
if (::readlink("/proc/self/exe", buffer, sizeof(buffer) - 1) > 0)
|
||||||
|
{
|
||||||
|
printf("Found exec link: %s\n", buffer);
|
||||||
|
run_arg = buffer;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
char* argv[] = {run_arg.data(), err_arg.data(), data.data(), nullptr};
|
||||||
|
int ret = posix_spawn(&pid, run_arg.c_str(), nullptr, nullptr, argv, environ);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue