Qt: create rpcs3 shortcuts

This commit is contained in:
Megamouse 2022-02-12 02:19:46 +01:00
parent e5bb0ba004
commit 0a34403ef8
11 changed files with 429 additions and 24 deletions

View file

@ -16,6 +16,8 @@
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
LOG_CHANNEL(sys_log, "SYS");
@ -113,6 +115,31 @@ namespace rpcs3::utils
const usz last = path_to_exe.find_last_of('\\');
return last == std::string::npos ? std::string("") : path_to_exe.substr(0, last + 1);
}
#elif !defined(__APPLE__)
std::string get_executable_path()
{
if (const char* appimage_path = ::getenv("APPIMAGE"))
{
sys_log.notice("Found AppImage path: %s", appimage_path);
return std::string(appimage_path);
}
sys_log.warning("Failed to find AppImage path");
char exe_path[PATH_MAX];
const ssize_t len = ::readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
if (len == -1)
{
sys_log.error("Failed to find executable path");
return {};
}
exe_path[len] = '\0';
sys_log.trace("Found exec path: %s", exe_path);
return std::string(exe_path);
}
#endif
std::string get_emu_dir()