--- gnome-session-2.9.4/gnome-session/gsm-sound.c.orig Tue Oct 8 05:01:09 2002 +++ gnome-session-2.9.4/gnome-session/gsm-sound.c Mon Feb 28 03:51:11 2005 @@ -60,13 +60,43 @@ { GError *err = NULL; time_t starttime; + gchar *base, *path, *command; - if (!g_spawn_command_line_async (ESD_SERVER" -nobeeps", &err)) + base = g_path_get_basename(ESD_SERVER); /* gets always something */ + if (g_ascii_strcasecmp(".", base)) { /* ok - this is paranoid ;-) */ + g_free(base); + base = g_strdup("esd"); + } + /* first try to get the esd in the gnome-session's dir */ + command = g_get_origin(); + if (command != NULL) { + path = g_build_filename(path, base, NULL); + if ((!g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)) + || g_file_test (path, G_FILE_TEST_IS_DIR) + { + g_free(path); + path = NULL; + } + g_free(command); + } + if ( path == NULL) { + path = g_find_program_in_path(base); + if (path == NULL) { + /* if not found, use the hard coded value */ + path = g_strdup(ESD_SERVER); + } + } + command = g_strjoin (" ", path, "-nobeeps", NULL); + g_free(base); + g_free(path); + if (!g_spawn_command_line_async (command, &err)) { g_warning ("Could not start esd: %s\n", err->message); + g_free(command); g_error_free (err); return; } + g_free(command); starttime = time (NULL); gnome_sound_init (NULL);