On Mon, 15 Apr 2019 14:16:53 +0300 "Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote: > I still think that if you build KernelShark from source, the most > natural default path for the open-file dialogs is the > trace-cmd/kernel-shark directory. However if this directory doesn't > exist the dialogs can start at ${HOME} (the one of the user running the > app). What you can do, and this is what some other applications do, is to check the relative path of the binary. There's a few ways to accomplish this. But once you know the exact path that the application ran from, you can then check if the plugins exist relatively to the executable. > > > I still think that if you build KernelShark from source, the most > natural default path for the open-file dialogs is the > trace-cmd/kernel-shark directory. However if this directory doesn't > exist {distro installation} the dialogs can start at ${HOME} (the one of > the user running the app). If I run kernelshark via: kernelshark/bin/kernelshark that full path name will be in argv[0]. If I run it as: ./kernelshark we can look at that too. Perhaps we should only check this if it's executed by a local path name (that is, if it is found via the $PATH variable, we don't do this), which would be the case if argv[0] == "kernelshark" and not "./kernelshark" or something like that. That is, we have something like this: if (strstr(argv[0], "/")) { char *fullpath = strdup(argv[0]); char *path, *local_plugin_path; struct stat sb; if (!fullpath) die(...); path = dirname(fullpath); ret = asprintf(&local_plugin_path, "%s/../../plugins"); if (!ret) die (...); ret = stat(local_plugin_path, &sb); if (!ret) { if ((sb.st_mode & S_IFMT) == S_IFDIR) use_local_plugin_path = true; } free(fullpath); free(local_plugin_path); } That way if you run this from the source directory, we use the source plugin files, otherwise, we use the default ones. -- Steve