To actually return the path of the executable, not its
directory.
https://bugzilla.gnome.org/show_bug.cgi?id=788256
find_executable_path (void)
{
GError *error = NULL;
- gchar *path;
if (_gst_executable_path)
return;
- path = g_file_read_link ("/proc/self/exe", &error);
-
- if (path) {
- _gst_executable_path = g_path_get_dirname (path);
- g_free (path);
- }
+ _gst_executable_path = g_file_read_link ("/proc/self/exe", &error);
+ if (error)
+ g_error_free (error);
}
#elif defined(G_OS_WIN32)
static void
gchar *full_path;
if (paths_are_relative_to_exe && !g_path_is_absolute (path)) {
+ gchar *appdir;
+
if (!_gst_executable_path) {
GST_FIXME_OBJECT (plugin,
"Path dependency %s relative to executable path but could not retrieve executable path",
path);
continue;
}
- full_path = g_build_filename (_gst_executable_path, path, NULL);
+ appdir = g_path_get_dirname (_gst_executable_path);
+ full_path = g_build_filename (appdir, path, NULL);
+ g_free (appdir);
} else {
full_path = g_strdup (path);
}