changeset 438:4fec4a3ca1a4 trunk

[svn] - evdev-plug: check that the player local datadir exists before attempting to create evdev-plug.conf
author giacomo
date Mon, 15 Jan 2007 14:04:11 -0800
parents e1c6b223431e
children 84029a5250c1
files ChangeLog src/evdev-plug/ed_internals.c
diffstat 2 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 15 13:25:41 2007 -0800
+++ b/ChangeLog	Mon Jan 15 14:04:11 2007 -0800
@@ -1,3 +1,20 @@
+2007-01-15 21:25:41 +0000  Giacomo Lozito <james@develia.org>
+  revision [958]
+  - amidiplug: on midi backend init, pass a function that helps the backend to get the location of amidi-plug.conf
+  trunk/src/amidi-plug/Makefile                          |    2 -
+  trunk/src/amidi-plug/backend-alsa/b-alsa.c             |    9 ++---
+  trunk/src/amidi-plug/backend-alsa/b-alsa.h             |    3 +
+  trunk/src/amidi-plug/backend-dummy/b-dummy.c           |    9 ++---
+  trunk/src/amidi-plug/backend-dummy/b-dummy.h           |    3 +
+  trunk/src/amidi-plug/backend-fluidsynth/b-fluidsynth.c |    9 ++---
+  trunk/src/amidi-plug/backend-fluidsynth/b-fluidsynth.h |    3 +
+  trunk/src/amidi-plug/i_backend.c                       |    4 +-
+  trunk/src/amidi-plug/i_backend.h                       |    3 +
+  trunk/src/amidi-plug/i_configure.c                     |   29 ++++++++---------
+  trunk/src/amidi-plug/i_configure_file.h                |   29 +++++++++++++++++
+  11 files changed, 67 insertions(+), 36 deletions(-)
+
+
 2007-01-15 20:46:38 +0000  Giacomo Lozito <james@develia.org>
   revision [956]
   - make amidi-plug use audacious_get_localdir()
--- a/src/evdev-plug/ed_internals.c	Mon Jan 15 13:25:41 2007 -0800
+++ b/src/evdev-plug/ed_internals.c	Mon Jan 15 14:04:11 2007 -0800
@@ -802,7 +802,6 @@
 
   config_datadir = (gchar*)audacious_get_localdir();
   config_pathfilename = g_build_filename( config_datadir , PLAYER_LOCALRC_FILE , NULL );
-  g_free( config_datadir );
 
   keyfile = g_key_file_new();
 
@@ -825,13 +824,22 @@
   }
 
   keyfile_str = g_key_file_to_data( keyfile , &keyfile_str_len , NULL );
-  iochan = g_io_channel_new_file( config_pathfilename , "w" , NULL );
-  g_io_channel_set_encoding( iochan , "UTF-8" , NULL );
-  g_io_channel_write_chars( iochan , keyfile_str , keyfile_str_len , NULL , NULL );
-  g_io_channel_shutdown( iochan , TRUE , NULL );
-  g_io_channel_unref( iochan );
+  if ( g_file_test( config_datadir , G_FILE_TEST_IS_DIR ) == TRUE )
+  {
+    iochan = g_io_channel_new_file( config_pathfilename , "w" , NULL );
+    g_io_channel_set_encoding( iochan , "UTF-8" , NULL );
+    g_io_channel_write_chars( iochan , keyfile_str , keyfile_str_len , NULL , NULL );
+    g_io_channel_shutdown( iochan , TRUE , NULL );
+    g_io_channel_unref( iochan );
+  }
+  else
+  {
+    g_warning( _("event-device-plugin: unable to access local directory %s , settings will not be saved.\n") ,
+               config_datadir );
+  }
 
   g_free( keyfile_str );
+  g_free( config_datadir );
   g_key_file_free( keyfile );
   return 0;
 }