From 530666d24bd438ef2b9f9f37db4286b964d9e4e4 Mon Sep 17 00:00:00 2001 From: Duilio Protti Date: Fri, 12 Feb 2016 16:55:13 -0300 Subject: [PATCH] Load effects file from prefix-based path --- src/Makefile.am | 2 +- src/effects.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5754a74..3de0fcf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ localedir = $(infinity_datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ AM_CFLAGS = @CFLAGS@ @AUDACIOUS_CFLAGS@ @AUDCLIENT_CFLAGS@ @SDL_CFLAGS@ @GTK_CFLAGS@\ - @GLIB_CFLAGS@ @DBUSGLIB1_CFLAGS@ $(INF_CFLAGS_EXTRA) + @GLIB_CFLAGS@ @DBUSGLIB1_CFLAGS@ $(INF_CFLAGS_EXTRA) -DDATADIR='"$(datadir)"' libinfinite_la_LDFLAGS = -export-dynamic -avoid-version libinfinite_la_LIBADD = @AUDACIOUS_LIBS@ @AUDCLIENT_LIBS@ @SDL_LIBS@ @GTK_LIBS@ @GLIB_LIBS@ @DBUSGLIB1_LIBS@ diff --git a/src/effects.c b/src/effects.c index 16ac523..b7b129e 100644 --- a/src/effects.c +++ b/src/effects.c @@ -6,6 +6,8 @@ #include #include +#define EFFECTS_FILE (DATADIR "/infinite_states") + static t_effect effects[100]; static gint32 nb_effects = 0; static gboolean initialized = FALSE; @@ -17,11 +19,10 @@ void effects_save_effect (t_effect *effect) gint32 i; g_assert (effect); - /** TODO Remove hardcoded path */ - f = fopen ("/usr/local/share/audacious/infinite_states","a"); + f = fopen (EFFECTS_FILE,"a"); if (f == NULL) { - g_warning (_("Could not be opened file %s for saving effects\n"), - datafile); + g_warning (_("Cannot open file %s for saving effects\n"), + EFFECTS_FILE); return ; } for (i = 0; i < sizeof(t_effect); i++) @@ -37,10 +38,10 @@ void effects_load_effects (void) gint32 finished = 0; gint32 i, b, c, d, e; - f = fopen ("/usr/local/share/audacious/infinite_states","r"); + f = fopen (EFFECTS_FILE,"r"); if (f == NULL) { - g_warning (_("Could not be opened file %s for loading effects\n"), - datafile); + g_warning (_("Cannot open file %s for loading effects\n"), + EFFECTS_FILE); return ; } while (!finished) {