Commit 477d18c7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Replace config_Get(Data|Lib)Dir() with config_GetSysDir()

parent 5acf9322
......@@ -381,9 +381,9 @@ static int ScanParametersDvbS( vlc_object_t *p_access, dvb_sys_t *p_sys, scan_pa
char *psz_name = var_InheritString( p_access, "dvb-satellite" );
if( psz_name )
{
char *data_dir = config_GetDataDir();
char *data_dir = config_GetSysPath(VLC_PKG_DATA_DIR, "dvb/dvb-s");
if( !data_dir || -1 == asprintf( &p_scan->psz_scanlist_file,
"%s" DIR_SEP "dvb" DIR_SEP "dvb-s" DIR_SEP "%s", data_dir, psz_name ) )
"%s/%s", data_dir, psz_name ) )
{
p_scan->psz_scanlist_file = NULL;
}
......
......@@ -150,12 +150,10 @@ static std::string getHRTFPath(filter_t *p_filter)
}
else
{
char *dataDir = config_GetDataDir();
char *dataDir = config_GetSysPath(VLC_PKG_DATA_DIR, DEFAULT_HRTF_PATH);
if (dataDir != NULL)
{
std::stringstream ss;
ss << std::string(dataDir) << DIR_SEP << DEFAULT_HRTF_PATH;
HRTFPath = ss.str();
HRTFPath = std::string(dataDir);
free(dataDir);
}
}
......
......@@ -381,33 +381,25 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
#if (_POSIX_SPAWN >= 0)
/* Check if QApplication works */
char *libdir = config_GetLibDir();
if (likely(libdir != NULL))
{
char *path;
if (unlikely(asprintf(&path, "%s/vlc-qt-check", libdir) < 0))
path = NULL;
free(libdir);
if (unlikely(path == NULL))
return VLC_ENOMEM;
char *path = config_GetSysPath(VLC_PKG_LIB_DIR, "vlc-qt-check");
if (unlikely(path == NULL))
return VLC_ENOMEM;
char *argv[] = { path, NULL };
pid_t pid;
char *argv[] = { path, NULL };
pid_t pid;
int val = posix_spawn(&pid, path, NULL, NULL, argv, environ);
free(path);
if (val)
return VLC_ENOMEM;
int val = posix_spawn(&pid, path, NULL, NULL, argv, environ);
free(path);
if (val)
return VLC_ENOMEM;
int status;
while (waitpid(pid, &status, 0) == -1);
int status;
while (waitpid(pid, &status, 0) == -1);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
{
msg_Dbg(p_this, "Qt check failed (%d). Skipping.", status);
return VLC_EGENERIC;
}
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
{
msg_Dbg(p_this, "Qt check failed (%d). Skipping.", status);
return VLC_EGENERIC;
}
#endif
......
......@@ -220,7 +220,7 @@ bool OS2Factory::init()
char *datadir = config_GetUserDir( VLC_USER_DATA_DIR );
m_resourcePath.push_back( (std::string)datadir + "\\skins" );
free( datadir );
datadir = config_GetDataDir();
datadir = config_GetSysPath(VLC_PKG_DATA_DIR, NULL);
m_resourcePath.push_back( (std::string)datadir + "\\skins" );
m_resourcePath.push_back( (std::string)datadir + "\\skins2" );
m_resourcePath.push_back( (std::string)datadir + "\\share\\skins" );
......
......@@ -236,7 +236,7 @@ bool Win32Factory::init()
char *datadir = config_GetUserDir( VLC_USERDATA_DIR );
m_resourcePath.push_back( (std::string)datadir + "\\skins" );
free( datadir );
datadir = config_GetDataDir();
datadir = config_GetSysPath(VLC_PKG_DATA_DIR, NULL);
m_resourcePath.push_back( (std::string)datadir + "\\skins" );
m_resourcePath.push_back( (std::string)datadir + "\\skins2" );
m_resourcePath.push_back( (std::string)datadir + "\\share\\skins" );
......
......@@ -90,8 +90,8 @@ bool X11Factory::init()
m_resourcePath.push_back( (std::string)datadir + "/skins2" );
free( datadir );
m_resourcePath.push_back( (std::string)"share/skins2" );
datadir = config_GetDataDir();
m_resourcePath.push_back( (std::string)datadir + "/skins2" );
datadir = config_GetSysPath(VLC_PKG_DATA_DIR, "skins2");
m_resourcePath.push_back( (std::string)datadir );
free( datadir );
// Determine the monitor geometry
......
......@@ -104,7 +104,7 @@ static int vlclua_config_set( lua_State *L )
*****************************************************************************/
static int vlclua_datadir( lua_State *L )
{
char *psz_data = config_GetDataDir();
char *psz_data = config_GetSysPath(VLC_PKG_DATA_DIR, NULL);
lua_pushstring( L, psz_data );
free( psz_data );
return 1;
......
......@@ -223,8 +223,8 @@ int vlclua_dir_list(const char *luadirname, char ***restrict listp)
list = vlclua_dir_list_append(list, config_GetUserDir(VLC_USERDATA_DIR),
luadirname);
char *libdir = config_GetLibDir();
char *datadir = config_GetDataDir();
char *libdir = config_GetSysPath(VLC_PKG_LIB_DIR, NULL);
char *datadir = config_GetSysPath(VLC_PKG_DATA_DIR, NULL);
bool both = libdir != NULL && datadir != NULL && strcmp(libdir, datadir);
/* Tokenized Lua scripts in architecture-specific data directory */
......
......@@ -233,14 +233,13 @@ 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();
if( asprintf( &psz_pixbuf, "%s/icons/48x48/vlc.png", psz_data ) >= 0 )
char *psz_pixbuf = config_GetSysPath(VLC_PKG_DATA_DIR,
"icons/48x48/"PACKAGE".png");
if (psz_pixbuf != NULL)
{
pix = gdk_pixbuf_new_from_file( psz_pixbuf, &p_error );
free( psz_pixbuf );
}
free( psz_data );
}
}
......
......@@ -306,11 +306,7 @@ static void *Thread( void *p_data )
psz_preset_path = var_InheritString( p_filter, "projectm-preset-path" );
#ifdef _WIN32
if ( psz_preset_path == NULL )
{
char *psz_data_path = config_GetDataDir();
asprintf( &psz_preset_path, "%s" DIR_SEP "visualization", psz_data_path );
free( psz_data_path );
}
psz_preset_path = config_GetSysPath(VLC_PKG_DATA_DIR, "visualization");
#endif
psz_title_font = var_InheritString( p_filter, "projectm-title-font" );
......
......@@ -45,14 +45,8 @@ int vlc_bindtextdomain (const char *domain)
return -1;
}
# else
char *datadir = config_GetDataDir();
if (unlikely(datadir == NULL))
return -1;
char *upath;
int ret = asprintf (&upath, "%s" DIR_SEP "locale", datadir);
free (datadir);
if (unlikely(ret == -1))
char *upath = config_GetSysPath(VLC_PKG_DATA_DIR, "locale");
if (unlikely(upath == NULL))
return -1;
char *lpath = ToLocale(upath);
......
......@@ -77,14 +77,13 @@ struct subpicture_updater_sys_t
static char * GetDefaultArtUri( void )
{
char *psz_uri = NULL;
char *psz_path;
char *psz_datadir = config_GetDataDir();
if( asprintf( &psz_path, "%s/icons/128x128/vlc.png", psz_datadir ) >= 0 )
char *psz_path = config_GetSysPath(VLC_PKG_DATA_DIR,
"icons/128x128/"PACKAGE_NAME".png");
if( psz_path != NULL )
{
psz_uri = vlc_path2uri( psz_path, NULL );
free( psz_path );
}
free( psz_datadir );
return psz_uri;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment