From a07b13b192113a43fa3c8cf8eb846734bd803f1a Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 24 Sep 2013 11:11:44 +0200 Subject: [PATCH] [mapplauncherd] Add full path to argv[0] of invoked process This allows the application to look up its installation prefix (e.g. /usr) by just looking at argv[0] and calculating relative paths from there (previously one would need to pass the full path to invoker). --- src/invoker/invoker.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/invoker/invoker.c b/src/invoker/invoker.c index 5221722..401d207 100644 --- a/src/invoker/invoker.c +++ b/src/invoker/invoker.c @@ -745,6 +745,10 @@ int main(int argc, char *argv[]) prog_name = search_program(argv[optind]); prog_argc = argc - optind; prog_argv = &argv[optind]; + + // Force argv[0] of application to be the absolute path to allow the + // application to find out its installation directory from there + prog_argv[0] = prog_name; } // Check if application name isn't defined