Fixed how Linux registers the discord executable

This commit is contained in:
MysterD 2021-06-14 23:31:22 -07:00
parent 6d53fb7eaf
commit 88b304e52d
1 changed files with 4 additions and 2 deletions

View File

@ -104,8 +104,10 @@ static void register_launch_command(void) {
}
GetModuleFileName(hModule, cmd, sizeof(cmd));
#else
rc = readlink("/proc/self/exe", cmd, sizeof(MAX_LAUNCH_CMD) - 1);
if (rc) {
char path[MAX_LAUNCH_CMD] = { 0 };
snprintf(path, MAX_LAUNCH_CMD - 1, "/proc/%d/exe", getpid());
rc = readlink(path, cmd, MAX_LAUNCH_CMD - 1);
if (rc <= 0) {
LOG_ERROR("unable to retrieve absolute path! rc = %d", rc);
return;
}