diff --git a/src/launcher/runtimes/type1/main.c b/src/launcher/runtimes/type1/main.c index c8ca7a0..28701f3 100644 --- a/src/launcher/runtimes/type1/main.c +++ b/src/launcher/runtimes/type1/main.c @@ -48,6 +48,7 @@ Partly borrowed from #include #include +#include #include "md5.h" #include "appimagelauncher_interface.h" @@ -208,6 +209,10 @@ main(int argc, char* argv[], char** envp) { exit(1); } + strcpy(appimage_path, realpath(argv[1], NULL)); + strcpy(argv0_path, appimage_path); + argv[1] = appimage_path; + int envp_size = 0; for (char** envp_itr = envp; *envp_itr != NULL; ++envp_itr) envp_size++; @@ -218,16 +223,13 @@ main(int argc, char* argv[], char** envp) { // Allow to hook up an integration assistant. - if (shouldIntegrationAssistantBeUsedOn(argv[1]) && + if (shouldIntegrationAssistantBeUsedOn(appimage_path) && tryForwardExecToIntegrationAssistant(argc, argv, envp_copy) == 0) { // A '0' return value means that the assistant took care of the execution therefore we can safely exit fprintf(stdout, "AppImage execution was handled by the integration assistant\n"); return 0; } - - strcpy(appimage_path, argv[1]); - strcpy(argv0_path, argv[1]); setenv("TARGET_APPIMAGE", appimage_path, 1); setenv("DESKTOPINTEGRATION", "false", 1); diff --git a/src/launcher/runtimes/type2/main.c b/src/launcher/runtimes/type2/main.c index 20769d5..c6e813b 100644 --- a/src/launcher/runtimes/type2/main.c +++ b/src/launcher/runtimes/type2/main.c @@ -526,6 +526,10 @@ int main(int argc, char** argv, char** envp) { exit(1); } + strcpy(appimage_path, realpath(argv[1], NULL)); + strcpy(argv0_path, appimage_path); + argv[1] = appimage_path; + int envp_size = 0; for (char** envp_itr = envp; *envp_itr != NULL; ++envp_itr) envp_size++; @@ -536,15 +540,13 @@ int main(int argc, char** argv, char** envp) { // Allow to hook up an integration assistant. - if (shouldIntegrationAssistantBeUsedOn(argv[1]) && + if (shouldIntegrationAssistantBeUsedOn(appimage_path) && tryForwardExecToIntegrationAssistant(argc, argv, envp_copy) == 0) { // A '0' return value means that the assistant took care of the execution therefore we can safely exit fprintf(stdout, "AppImage execution was handled by the integration assistant\n"); return 0; } - strcpy(appimage_path, argv[1]); - strcpy(argv0_path, argv[1]); setenv("TARGET_APPIMAGE", appimage_path, 1); setenv("DESKTOPINTEGRATION", "false", 1);