Commit 9b6ca602 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use config_Get*Dir

parent f2ba521b
...@@ -225,8 +225,9 @@ bool Win32Factory::init() ...@@ -225,8 +225,9 @@ bool Win32Factory::init()
} }
// Initialize the resource path // Initialize the resource path
m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_datadir + char *datadir = config_GetUserDataDir();
"\\skins" ); m_resourcePath.push_back( (string)datadir + "\\skins" );
free( datadir );
m_resourcePath.push_back( (string)config_GetDataDir() + m_resourcePath.push_back( (string)config_GetDataDir() +
"\\skins" ); "\\skins" );
m_resourcePath.push_back( (string)config_GetDataDir() + m_resourcePath.push_back( (string)config_GetDataDir() +
......
...@@ -71,8 +71,9 @@ bool X11Factory::init() ...@@ -71,8 +71,9 @@ bool X11Factory::init()
ConnectionNumber( pDisplay ) ); ConnectionNumber( pDisplay ) );
// Initialize the resource path // Initialize the resource path
m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_datadir + char *datadir = config_GetUserDataDir();
+ "/skins2" ); m_resourcePath.push_back( (string)datadir + "/skins2" );
free( datadir );
m_resourcePath.push_back( (string)"share/skins2" ); m_resourcePath.push_back( (string)"share/skins2" );
m_resourcePath.push_back( (string)config_GetDataDir () + "/skins2" ); m_resourcePath.push_back( (string)config_GetDataDir () + "/skins2" );
......
...@@ -643,13 +643,6 @@ static int OpenClient (vlc_object_t *obj) ...@@ -643,13 +643,6 @@ static int OpenClient (vlc_object_t *obj)
p_sys->session.b_handshaked = false; p_sys->session.b_handshaked = false;
const char *homedir = obj->p_libvlc->psz_datadir,
*datadir = config_GetDataDir ();
size_t l1 = strlen (homedir), l2 = strlen (datadir);
char path[((l1 > l2) ? l1 : l2) + sizeof ("/ca-certificates.crt")];
// > sizeof ("/ssl/private")
// > sizeof ("/ssl/certs")
i_val = gnutls_certificate_allocate_credentials (&p_sys->x509_cred); i_val = gnutls_certificate_allocate_credentials (&p_sys->x509_cred);
if (i_val != 0) if (i_val != 0)
{ {
...@@ -658,23 +651,32 @@ static int OpenClient (vlc_object_t *obj) ...@@ -658,23 +651,32 @@ static int OpenClient (vlc_object_t *obj)
goto error; goto error;
} }
sprintf (path, "%s/ssl", homedir); char *userdir = config_GetUserDataDir ();
if (userdir != NULL)
{
char path[strlen (userdir) + sizeof ("/ssl/private")];
sprintf (path, "%s/ssl", userdir);
utf8_mkdir (path, 0755); utf8_mkdir (path, 0755);
sprintf (path, "%s/ssl/certs", homedir); sprintf (path, "%s/ssl/certs", userdir);
gnutls_Addx509Directory (VLC_OBJECT (p_session), gnutls_Addx509Directory (VLC_OBJECT (p_session),
p_sys->x509_cred, path, false); p_sys->x509_cred, path, false);
sprintf (path, "%s/ssl/private", userdir);
gnutls_Addx509Directory (VLC_OBJECT (p_session), p_sys->x509_cred,
path, true);
free (userdir);
}
const char *datadir = config_GetDataDir ();
{
char path[strlen (datadir) + sizeof ("/ca-certificates.crt")];
sprintf (path, "%s/ca-certificates.crt", datadir); sprintf (path, "%s/ca-certificates.crt", datadir);
gnutls_Addx509File (VLC_OBJECT (p_session), gnutls_Addx509File (VLC_OBJECT (p_session),
p_sys->x509_cred, path, false); p_sys->x509_cred, path, false);
}
p_session->pf_handshake = gnutls_HandshakeAndValidate; p_session->pf_handshake = gnutls_HandshakeAndValidate;
/*p_session->pf_handshake = gnutls_ContinueHandshake;*/ /*p_session->pf_handshake = gnutls_ContinueHandshake;*/
sprintf (path, "%s/ssl/private", homedir);
gnutls_Addx509Directory (VLC_OBJECT (p_session), p_sys->x509_cred,
path, true);
i_val = gnutls_init (&p_sys->session.session, GNUTLS_CLIENT); i_val = gnutls_init (&p_sys->session.session, GNUTLS_CLIENT);
if (i_val != 0) if (i_val != 0)
{ {
......
...@@ -164,12 +164,16 @@ int vlclua_homedir( lua_State *L ) ...@@ -164,12 +164,16 @@ int vlclua_homedir( lua_State *L )
} }
int vlclua_configdir( lua_State *L ) int vlclua_configdir( lua_State *L )
{ {
lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_configdir ); char *dir = config_GetConfigDir();
lua_pushstring( L, dir );
free( dir );
return 1; return 1;
} }
int vlclua_cachedir( lua_State *L ) int vlclua_cachedir( lua_State *L )
{ {
lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_cachedir ); char *dir = config_GetCacheDir();
lua_pushstring( L, dir );
free( dir );
return 1; return 1;
} }
int vlclua_datadir_list( lua_State *L ) int vlclua_datadir_list( lua_State *L )
...@@ -400,9 +404,17 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname, ...@@ -400,9 +404,17 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname,
char **ppsz_dir_list ) char **ppsz_dir_list )
{ {
int i = 0; int i = 0;
char *datadir = config_GetUserDataDir();
if( datadir == NULL )
return VLC_ENOMEM;
if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "lua" DIR_SEP "%s", if( asprintf( &ppsz_dir_list[i], "%s" DIR_SEP "lua" DIR_SEP "%s",
p_this->p_libvlc->psz_datadir, luadirname ) < 0 ) datadir, luadirname ) < 0 )
{
free( datadir );
return VLC_ENOMEM; return VLC_ENOMEM;
}
free( datadir );
i++; i++;
# if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32) # if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32)
......
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