]> git.sesse.net Git - vlc/commitdiff
Use environment variable for data directory
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 20 Mar 2012 18:41:56 +0000 (20:41 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 20 Mar 2012 18:43:31 +0000 (20:43 +0200)
...as for plugins directory. Most of the content is anyway per-process,
either because gettext and interfaces are per-process. The only caller
of the function that is not an interface or gettext is the DVB scanner.
This is even probably a bug.

13 files changed:
bin/vlc.c
bin/winvlc.c
include/vlc_configuration.h
modules/access/dvb/scan.c
modules/gui/hildon/maemo.c
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/x11/x11_factory.cpp
modules/lua/libs/configuration.c
modules/lua/vlc.c
modules/notify/growl.m
modules/notify/notify.c
modules/visualization/projectm.cpp
src/config/dirs.c

index 80418f1ff0fa55eb43749823bb71d3e468848253..46c7d7d6d623b547b0e45a3225fc9692cbbf8943 100644 (file)
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -100,6 +100,7 @@ int main( int i_argc, const char *ppsz_argv[] )
 
 #ifdef TOP_BUILDDIR
     setenv ("VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1);
+    setenv ("VLC_DATA_PATH", TOP_SRCDIR"/share", 1);
 #endif
 
     /* Clear the X.Org startup notification ID. Otherwise the UI might try to
@@ -167,14 +168,11 @@ int main( int i_argc, const char *ppsz_argv[] )
     /* Block all these signals */
     pthread_sigmask (SIG_SETMASK, &set, NULL);
 
-    const char *argv[i_argc + 3];
+    const char *argv[i_argc + 2];
     int argc = 0;
 
     argv[argc++] = "--no-ignore-config";
     argv[argc++] = "--media-library";
-#ifdef TOP_SRCDIR
-    argv[argc++] = "--data-path="TOP_SRCDIR"/share";
-#endif
     ppsz_argv++; i_argc--; /* skip executable path */
 #ifdef __APPLE__
     /* When VLC.app is run by double clicking in Mac OS X, the 2nd arg
index 42a3d56dad2d67655006427913eac45cf8e7d968..ce17c957539ad8477bf55d8e5bd90aa84d57a256 100644 (file)
@@ -123,6 +123,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
 #ifndef UNDER_CE
 #ifdef TOP_BUILDDIR
     putenv("VLC_PLUGIN_PATH=Z:"TOP_BUILDDIR"/modules");
+    putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share");
 #endif
 
     HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
index e9ca96b51e27454e8bbcb10564ff8adbe1e553ef..e3b17a56d911cc86d82081c4163eeb5a5844cab5 100644 (file)
@@ -194,8 +194,7 @@ VLC_API void config_ResetAll( vlc_object_t * );
 #define config_ResetAll(a) config_ResetAll(VLC_OBJECT(a))
 
 VLC_API module_config_t * config_FindConfig( vlc_object_t *, const char * ) VLC_USED;
-VLC_API char * config_GetDataDir( vlc_object_t * ) VLC_USED VLC_MALLOC;
-#define config_GetDataDir(a) config_GetDataDir(VLC_OBJECT(a))
+VLC_API char * config_GetDataDir(void) VLC_USED VLC_MALLOC;
 VLC_API char *config_GetLibDir(void) VLC_USED;
 VLC_API const char * config_GetConfDir( void ) VLC_USED;
 
index 5f75e58a81a9b5834cba6407b8e61550f8f8a5bd..5ad618711b755a94183df557fe241a359d3fef6f 100644 (file)
@@ -248,7 +248,7 @@ static int ScanDvbSNextFast( scan_t *p_scan, scan_configuration_t *p_cfg, double
         DIR *p_dir;
 
         char *psz_dir = NULL;
-        char *data_dir = config_GetDataDir( p_scan->p_obj );
+        char *data_dir = config_GetDataDir();
 
         if( asprintf( &psz_dir, "%s" DIR_SEP "dvb" DIR_SEP "dvb-s", data_dir ) == -1 )
             psz_dir = NULL;
index 9fa98097bfdf8123d5e69326451ee34b11e7efb6..7f2619db49522deb714d307179dc3c3d3df9535a 100644 (file)
@@ -173,7 +173,7 @@ static void *Thread( void *obj )
 
     // A little theming
     char *psz_rc_file = NULL;
-    char *psz_data = config_GetDataDir( p_intf );
+    char *psz_data = config_GetDataDir();
     if( asprintf( &psz_rc_file, "%s/maemo/vlc_intf.rc", psz_data ) != -1 )
     {
         gtk_rc_parse( psz_rc_file );
index 6d8e2d95257bb1f7e45d8bb4dd1ace6058611bd1..237b4d5847e1cf3057fb13b624dff635ad8834e9 100644 (file)
@@ -234,7 +234,7 @@ bool Win32Factory::init()
     char *datadir = config_GetUserDir( VLC_DATA_DIR );
     m_resourcePath.push_back( (string)datadir + "\\skins" );
     free( datadir );
-    datadir = config_GetDataDir( getIntf() );
+    datadir = config_GetDataDir();
     m_resourcePath.push_back( (string)datadir + "\\skins" );
     m_resourcePath.push_back( (string)datadir + "\\skins2" );
     m_resourcePath.push_back( (string)datadir + "\\share\\skins" );
index 1e2330012fb2b485606435957aa2e879c565a649..26b881d78d2c4909d1f276502003b9966545f3fe 100644 (file)
@@ -87,7 +87,7 @@ bool X11Factory::init()
     m_resourcePath.push_back( (string)datadir + "/skins2" );
     free( datadir );
     m_resourcePath.push_back( (string)"share/skins2" );
-    datadir = config_GetDataDir( getIntf() );
+    datadir = config_GetDataDir();
     m_resourcePath.push_back( (string)datadir + "/skins2" );
     free( datadir );
 
index b0c76ce8b7a3367dd3150d3f7df7ec49102446be..a640c3e914dffc6994c972f77fbbdf51e92f3b96 100644 (file)
@@ -107,7 +107,7 @@ static int vlclua_config_set( lua_State *L )
  *****************************************************************************/
 static int vlclua_datadir( lua_State *L )
 {
-    char *psz_data = config_GetDataDir( vlclua_get_this( L ) );
+    char *psz_data = config_GetDataDir();
     lua_pushstring( L, psz_data );
     free( psz_data );
     return 1;
index 963a67d062164e832eb88dfeb73ede53a7afdf50..1fb969f696cf794ca31c80c36a9e2decfdba8edb 100644 (file)
@@ -226,7 +226,7 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname,
     }
 #endif
 
-    char *psz_datapath = config_GetDataDir( p_this );
+    char *psz_datapath = config_GetDataDir();
     if( likely(psz_datapath != NULL) )
     {
         if( likely(asprintf( &ppsz_dir_list[i], "%s"DIR_SEP"lua"DIR_SEP"%s",
index 329144f05b447b695c6168a8fe8668b923c9c712..8ce883581723bc68fde40e08c2744e96735826cd 100644 (file)
@@ -117,7 +117,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->app_name = CFSTR( "VLC media player" );
     p_sys->notification_type = CFSTR( "New input playing" );
     
-    char *data_path = config_GetDataDir ( p_this );
+    char *data_path = config_GetDataDir ();
     char buf[strlen (data_path) + sizeof ("/vlc512x512.png")];
     snprintf (buf, sizeof (buf), "%s/vlc512x512.png", data_path);
     msg_Dbg( p_this, "looking for icon at %s", buf );
index 0dc494d07fc5f9e20de189da3dd00b647f82075c..c07015ba27488cca97aab64d4874187eadf49ddf 100644 (file)
@@ -240,7 +240,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
         /* Load icon from share/ */
             GError *p_error = NULL;
             char *psz_pixbuf;
-            char *psz_data = config_GetDataDir( p_this );
+            char *psz_data = config_GetDataDir();
             if( asprintf( &psz_pixbuf, "%s/icons/48x48/vlc.png", psz_data ) >= 0 )
             {
                 pix = gdk_pixbuf_new_from_file( psz_pixbuf, &p_error );
index c21ecb6f69ee5b8d8f5b6d361f3e4b80e1b1dc44..9d76223a4630a9fb48c981f6768c94b715488bb4 100644 (file)
@@ -369,7 +369,7 @@ static void *Thread( void *p_data )
 #ifdef WIN32
     if ( psz_preset_path == NULL )
     {
-        char *psz_data_path = config_GetDataDir( p_filter );
+        char *psz_data_path = config_GetDataDir();
         asprintf( &psz_preset_path, "%s" DIR_SEP "visualization", psz_data_path );
         free( psz_data_path );
     }
index 94002d9c993f89bd8f752b8b962ad75fefe52e75..4c1d00fe3cda17800d502c747dfa0ba39c8a5762 100644 (file)
 
 #include "configuration.h"
 
-#undef config_GetDataDir
 /**
  * Determines the shared architecture-independent data directory
  *
  * @return a string or NULL. Use free() to release.
  */
-char *config_GetDataDir( vlc_object_t *p_obj )
+char *config_GetDataDir(void)
 {
-    char *psz_path = var_InheritString( p_obj, "data-path" );
-    return psz_path ? psz_path : config_GetDataDirDefault();
+    const char *path = getenv ("VLC_DATA_PATH");
+    if (path)
+        return strdup (path);
+    return config_GetDataDirDefault();
 }