VLC_EXPORT(const char *, config_GetDataDir, ( void ));
VLC_EXPORT(const char *, config_GetConfDir, ( void ) );
+VLC_EXPORT(const char *, config_GetHomeDir, ( void ));
VLC_EXPORT(char *, config_GetUserConfDir, ( void ) );
VLC_EXPORT(char *, config_GetUserDataDir, ( void ) );
VLC_EXPORT(char *, config_GetCacheDir, ( void ) );
{
VLC_COMMON_MEMBERS
- /* Global properties */
- const char * psz_homedir; ///< user's home directory
-
+ /* FIXME: this is only used by the logger module! */
global_stats_t *p_stats; ///< Global statistics
-
/* Structure storing the action name / key associations */
struct hotkey
{
// and there is an off-by-one in the following sprintf().
return;
- const char *home = access->p_libvlc->psz_homedir;
+ const char *home = config_GetHomeDir();
/* Hmm what about the extension?? */
char filename[strlen (home) + sizeof ("/vlcdump-YYYYYYYYY-MM-DD-HH-MM-SS.ts")];
if( *psz == '\0' )
{
free( psz );
- if( p_access->p_libvlc->psz_homedir ) /* XXX: This should never happen */
- psz = strdup( p_access->p_libvlc->psz_homedir );
+ psz = strdup( config_GetHomeDir() );
}
p_sys->psz_path = psz;
msg_Dbg( p_access, "Record access filter path %s", psz );
if( psz_dir[0] == '~' )
{
char *dir;
- /* This is incomplete : we should also support the ~cmassiot/ syntax. */
- asprintf( &dir, "%s%s", p_intf->p_libvlc->psz_homedir, psz_dir + 1 );
+ asprintf( &dir, "%s%s", config_GetHomeDir(), psz_dir + 1 );
free( psz_dir );
psz_dir = dir;
}
if( p_box->i_type == FOURCC_drms )
{
p_box->data.p_sample_soun->p_drms =
- drms_alloc( p_stream->p_libvlc->psz_homedir );
+ drms_alloc( config_GetHomeDir() );
if( p_box->data.p_sample_soun->p_drms == NULL )
{
}
else
{
- p_sys->psz_current_dir = strdup( p_intf->p_libvlc->psz_homedir );
+ p_sys->psz_current_dir = strdup( config_GetHomeDir() );
}
free( val.psz_string );
void FileConfigControl::updateField()
{
QString file = QFileDialog::getOpenFileName( NULL,
- qtr( "Select File" ), qfu( p_this->p_libvlc->psz_homedir ) );
+ qtr( "Select File" ), qfu( config_GetHomeDir() ) );
if( file.isNull() ) return;
text->setText( file );
}
QString dir = QFileDialog::getExistingDirectory( NULL,
qtr( "Select Directory" ),
text->text().isEmpty() ?
- qfu( p_this->p_libvlc->psz_homedir ) : text->text(),
+ qfu( config_GetHomeDir() ) : text->text(),
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks );
if( dir.isNull() ) return;
updateButton->setEnabled( false );
QString dest_dir = QFileDialog::getExistingDirectory( this,
qtr( "Select a directory ..." ),
- qfu( p_update->p_libvlc->psz_homedir ) );
+ qfu( config_GetHomeDir() ) );
if( dest_dir != "" )
{
{
QString saveLogFileName = QFileDialog::getSaveFileName(
this, qtr( "Choose a filename to save the logs under..." ),
- qfu( p_intf->p_libvlc->psz_homedir ),
+ qfu( config_GetHomeDir() ),
qtr( "Texts / Logs (*.log *.txt);; All (*.*) ") );
if( !saveLogFileName.isNull() )
{
QString saveVLMConfFileName = QFileDialog::getSaveFileName(
this, qtr( "Choose a filename to save the VLM configuration..." ),
- qfu( p_intf->p_libvlc->psz_homedir ),
+ qfu( config_GetHomeDir() ),
qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
if( !saveVLMConfFileName.isEmpty() )
{
QString openVLMConfFileName = QFileDialog::getOpenFileName(
this, qtr( "Choose a VLM configuration file to open..." ),
- qfu( p_intf->p_libvlc->psz_homedir ),
+ qfu( config_GetHomeDir() ),
qtr( "VLM conf (*.vlm) ;; All (*.*)" ) );
if( !openVLMConfFileName.isEmpty() )
/* retrieve last known path used in file browsing */
char *psz_path = config_GetPsz( p_intf, "qt-filedialog-path" );
p_intf->p_sys->psz_filepath = EMPTY_STR( psz_path ) ? psz_path
- : p_intf->p_libvlc->psz_homedir;
+ : config_GetHomeDir();
#ifdef UPDATE_CHECK
/* Checking for VLC updates */
if( !psz_file )
{
#ifdef __APPLE__
- char *psz_homedir = p_this->p_libvlc->psz_homedir;
-
- if( !psz_homedir ) /* XXX: This should never happen */
- {
- msg_Err( p_this, "unable to find home directory" );
- return -1;
- }
- psz_file = (char *)malloc( sizeof("/" LOG_DIR "/" LOG_FILE_HTML) +
- strlen(psz_homedir) );
- if( psz_file )
- {
- switch( p_intf->p_sys->i_mode )
- {
- case MODE_HTML:
- sprintf( psz_file, "%s/" LOG_DIR "/" LOG_FILE_HTML,
- psz_homedir );
- break;
- case MODE_TEXT:
- default:
- sprintf( psz_file, "%s/" LOG_DIR "/" LOG_FILE_TEXT,
- psz_homedir );
- break;
- }
- }
+ if( asprintf( &psz_file, "%s/"LOG_DIR"/%s", config_GetHomeDir(),
+ (p_intf->p_sys->i_mode == MODE_HTML) ? LOG_FILE_HTML
+ : LOG_FILE_TEXT ) == -1 )
+ psz_file = NULL;
#else
switch( p_intf->p_sys->i_mode )
{
}
int vlclua_homedir( lua_State *L )
{
- lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_homedir );
+ lua_pushstring( L, config_GetHomeDir() );
return 1;
}
int vlclua_configdir( lua_State *L )
#define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b)
int __config_LoadCmdLine ( vlc_object_t *, int *, const char *[], bool );
-const char *config_GetHomeDir ( void );
char *config_GetCustomConfigFile( libvlc_int_t * );
int __config_LoadConfigFile( vlc_object_t *, const char * );
* Specification configs */
char *psz_old;
if( asprintf( &psz_old, "%s" DIR_SEP CONFIG_DIR DIR_SEP CONFIG_FILE,
- p_obj->p_libvlc->psz_homedir ) != -1 )
+ config_GetHomeDir() ) != -1 )
{
p_stream = utf8_fopen( psz_old, mode );
if( p_stream )
"VLC will now use %s.", psz_old, psz_filename );
char *psz_readme;
if( asprintf(&psz_readme,"%s"DIR_SEP CONFIG_DIR DIR_SEP"README",
- p_obj->p_libvlc->psz_homedir ) != -1 )
+ config_GetHomeDir() ) != -1 )
{
FILE *p_readme = utf8_fopen( psz_readme, "wt" );
if( p_readme )
{
/* This is incomplete: we should also support the ~cmassiot/ syntax */
char *psz_buf;
- if( asprintf( &psz_buf, "%s/%s", p_libvlc->psz_homedir,
+ if( asprintf( &psz_buf, "%s/%s", config_GetHomeDir(),
psz_configfile + 2 ) == -1 )
{
free( psz_configfile );
}
/* Set the config file stuff */
- p_libvlc->psz_homedir = config_GetHomeDir();
priv->psz_configfile = config_GetCustomConfigFile( p_libvlc );
/* Check for plugins cache options */
config_GetConfDir
config_GetDataDir
__config_GetFloat
+config_GetHomeDir
__config_GetInt
__config_GetPsz
__config_GetType
}
#if defined(__APPLE__) || defined(SYS_BEOS)
- if( !val.psz_string && p_vout->p_libvlc->psz_homedir )
+ if( !val.psz_string )
{
if( asprintf( &val.psz_string, "%s/Desktop",
- p_vout->p_libvlc->psz_homedir ) == -1 )
+ config_GetHomeDir() ) == -1 )
val.psz_string = NULL;
}
#elif defined(WIN32) && !defined(UNDER_CE)
- if( !val.psz_string && p_vout->p_libvlc->psz_homedir )
+ if( !val.psz_string )
{
/* Get the My Pictures folder path */
if( p_mypicturesdir == NULL )
{
- if( asprintf( &val.psz_string, "%s",
- p_vout->p_libvlc->psz_homedir ) == -1 )
+ if( asprintf( &val.psz_string, "%s", config_GetHomeDir() ) == -1 )
val.psz_string = NULL;
}
else