]> git.sesse.net Git - vlc/blobdiff - src/control/media_library.c
rtmp_amf_flv: Try and refactor a bit by reducing overly long
[vlc] / src / control / media_library.c
index 2075f310b0438415806134d92c0d17fef6d5c9c8..9b4d63012e52c4f594a923d06566352b6f38056e 100644 (file)
@@ -108,23 +108,22 @@ void
 libvlc_media_library_load( libvlc_media_library_t * p_mlib,
                            libvlc_exception_t * p_e )
 {
-    char *psz_datadir = config_GetUserDataDir();
+    char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
     char * psz_uri;
 
-    if( !psz_datadir ) /* XXX: i doubt that this can ever happen */
-    {
-        libvlc_exception_raise( p_e, "Can't get data directory" );
-        return;
-    }
-
-    if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
+    if( psz_datadir == NULL
+     || asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
                   psz_datadir ) == -1 )
+        psz_uri = NULL;
+    free( psz_datadir );
+
+    if( psz_uri == NULL )
     {
-        free( psz_datadir );
-        libvlc_exception_raise( p_e, "Can't get create the path" );
+        libvlc_exception_raise( p_e );
+        libvlc_printerr( "Not enough memory" );
         return;
     }
-    free( psz_datadir );
+
     if( p_mlib->p_mlist )
         libvlc_media_list_release( p_mlib->p_mlist );
 
@@ -145,7 +144,8 @@ libvlc_media_library_save( libvlc_media_library_t * p_mlib,
                            libvlc_exception_t * p_e )
 {
     (void)p_mlib;
-    libvlc_exception_raise( p_e, "Not supported" );
+    libvlc_exception_raise( p_e );
+    libvlc_printerr( "Function not implemented" );
 }
 
 /**************************************************************************