Merge branch 'fix-g_find_program_in_path' into 'main'

gutils: Fix g_find_program_in_path() to return an absolute path

Closes #2586

See merge request GNOME/glib!2460
This commit is contained in:
Sebastian Dröge 2022-01-27 10:50:36 +00:00
commit 13ee46538f

View File

@ -456,7 +456,14 @@ g_find_program_in_path (const gchar *program)
!g_file_test (startp, G_FILE_TEST_IS_DIR)) !g_file_test (startp, G_FILE_TEST_IS_DIR))
{ {
gchar *ret; gchar *ret;
if (g_path_is_absolute (startp)) {
ret = g_strdup (startp); ret = g_strdup (startp);
} else {
gchar *cwd = NULL;
cwd = g_get_current_dir ();
ret = g_build_filename (cwd, startp, NULL);
g_free (cwd);
}
g_free (freeme); g_free (freeme);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
g_free ((gchar *) path_copy); g_free ((gchar *) path_copy);