Exemple #1
0
gboolean
mu_util_supports (MuFeature feature)
{

	/* check for Guile support */
#ifndef BUILD_GUILE
	if (feature & MU_FEATURE_GUILE)
		return FALSE;
#endif /*BUILD_GUILE*/

	/* check for Gnuplot */
	if (feature & MU_FEATURE_GNUPLOT)
		if (!mu_util_program_in_path ("gnuplot"))
			return FALSE;

	return TRUE;
}
Exemple #2
0
gboolean
mu_util_play (const char *path, gboolean allow_local, gboolean allow_remote,
	      GError **err)
{
	gboolean rv;
	const gchar *argv[3];
	const char *prog;

	g_return_val_if_fail (path, FALSE);
	g_return_val_if_fail (mu_util_is_local_file (path) || allow_remote,
			      FALSE);
	g_return_val_if_fail (!mu_util_is_local_file (path) || allow_local,
			      FALSE);

	prog = g_getenv ("MU_PLAY_PROGRAM");
	if (!prog) {
#ifdef __APPLE__
		prog = "open";
#else
		prog = "xdg-open";
#endif /*!__APPLE__*/
	}

	if (!mu_util_program_in_path (prog)) {
		mu_util_g_set_error (err, MU_ERROR_FILE_CANNOT_EXECUTE,
				     "cannot find '%s' in path", prog);
		return FALSE;
	}

	argv[0] = prog;
	argv[1] = path;
	argv[2] = NULL;

	err = NULL;
	rv = g_spawn_async (NULL, (gchar**)&argv, NULL,
			    G_SPAWN_SEARCH_PATH, NULL, NULL, NULL,
			    err);
	return rv;
}