]> git.sesse.net Git - vlc/commitdiff
config_GetDataDir(): returns path to VLC installed shared data
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 5 Mar 2006 11:10:34 +0000 (11:10 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 5 Mar 2006 11:10:34 +0000 (11:10 +0000)
include/configuration.h
include/vlc_symbols.h
src/misc/configuration.c

index 7ba41b797884b4a2930ad05e593a6015f1a87e19..f6bd71351648626ea7322877aa45562ce24a76c1 100644 (file)
@@ -181,6 +181,7 @@ VLC_EXPORT( void,   __config_PutPsz,   (vlc_object_t *, const char *, const char
 VLC_EXPORT( int,    __config_LoadCmdLine,  ( vlc_object_t *, int *, char *[], vlc_bool_t ) );
 VLC_EXPORT( char *,   config_GetHomeDir,     ( void ) );
 VLC_EXPORT( char *,   config_GetUserDir,     ( void ) );
+VLC_EXPORT( const char *, config_GetDataDir, ( const vlc_object_t * ) );
 VLC_EXPORT( int,    __config_LoadConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( int,    __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( void,   __config_ResetAll, ( vlc_object_t * ) );
index ee4fe882abc239a4c18d0fe91acb530489b3ffb6..02440c50243859fe081624bcfac7a26ff85f5e3f 100644 (file)
@@ -476,6 +476,7 @@ struct module_symbols_t
     int (*utf8_mkdir_inner) (const char *filename);
     vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
     int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int, int);
+    const char * (*config_GetDataDir_inner) (const vlc_object_t *);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -932,6 +933,7 @@ struct module_symbols_t
 #  define utf8_mkdir (p_symbols)->utf8_mkdir_inner
 #  define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner
 #  define playlist_TreeMove (p_symbols)->playlist_TreeMove_inner
+#  define config_GetDataDir (p_symbols)->config_GetDataDir_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1391,6 +1393,7 @@ struct module_symbols_t
     ((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \
     ((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \
     ((p_symbols)->playlist_TreeMove_inner) = playlist_TreeMove; \
+    ((p_symbols)->config_GetDataDir_inner) = config_GetDataDir; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
     (p_symbols)->__stats_CounterGet_deprecated = NULL; \
     (p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
index d14486d296bae1e4dc72c6aca1d122991a5f6042..d7e52df21135c7b416704dc61bc28e4be9f2965d 100644 (file)
@@ -1676,6 +1676,30 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
     return 0;
 }
 
+/**
+ * config_GetDataDir: find directory where shared data is installed
+ *
+ * @return a string (always succeeds).
+ */
+const char *config_GetDataDir( const vlc_object_t *p_this )
+{
+#if defined (WIN32) || defined (UNDER_CE)
+    return p_this->p_libvlc->psz_vlcpath;
+#elif defined(__APPLE__) || defined (SYS_BEOS)
+    static char path[PATH_MAX] = "";
+
+    if( *path == '\0' )
+    {
+        snprintf( path, sizeof( path ), "%s/share",
+                  p_this->p_libvlc->psz_vlcpath );
+        path[sizeof( path ) - 1] = '\0';
+    }
+    return path;
+#else
+    return DATA_PATH;
+#endif
+}
+
 /*****************************************************************************
  * config_GetHomeDir, config_GetUserDir: find the user's home directory.
  *****************************************************************************