1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

fix discord launch arguments not working if RA was started from CWD or similar scenarios

This commit is contained in:
radius 2019-03-03 13:09:21 -05:00
parent 9ac7059d05
commit d22ce632e5

View File

@ -448,6 +448,7 @@ void discord_update(enum discord_presence presence)
void discord_init(void)
{
char full_path[PATH_MAX_LENGTH];
char command[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
@ -467,11 +468,17 @@ void discord_init(void)
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL);
#ifdef _WIN32
strlcpy(command, get_retroarch_launch_arguments(), sizeof(command));
GetModuleFileNameA(NULL, full_path, sizeof(full_path));
if (strstr(get_retroarch_launch_arguments(), full_path))
strlcpy(command, get_retroarch_launch_arguments(), sizeof(command));
else
{
path_basedir(full_path);
snprintf(command, sizeof(command), "%s%s", full_path, get_retroarch_launch_arguments());
}
#else
snprintf(command, sizeof(command), "sh -c %s", get_retroarch_launch_arguments());
#endif
RARCH_LOG("[discord] registering startup command: %s\n", command);
Discord_Register(settings->arrays.discord_app_id, command);
discord_ready = true;