Changeset 146dad54bff773b990752e44b92aa35f87cbc678
- Timestamp:
- 05/06/08 22:15:51
(2 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210104951 +0300
- git-parent:
[0038469d31d5ede7c49c5133c90e70d8a0a543dc]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210104479 +0300
- Message:
Use config_GetUserDataDir() internally
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rd6a7e48 |
r146dad5 |
|
| 90 | 90 | libvlc_exception_t * p_e ) |
|---|
| 91 | 91 | { |
|---|
| 92 | | const char *psz_datadir = |
|---|
| 93 | | libvlc_priv (p_mlib->p_libvlc_instance->p_libvlc_int)->psz_datadir; |
|---|
| | 92 | char *psz_datadir = config_GetUserDataDir(); |
|---|
| 94 | 93 | char * psz_uri; |
|---|
| 95 | 94 | |
|---|
| … | … | |
| 103 | 102 | psz_datadir ) == -1 ) |
|---|
| 104 | 103 | { |
|---|
| | 104 | free( psz_datadir ); |
|---|
| 105 | 105 | libvlc_exception_raise( p_e, "Can't get create the path" ); |
|---|
| 106 | 106 | return; |
|---|
| 107 | 107 | } |
|---|
| | 108 | free( psz_datadir ); |
|---|
| 108 | 109 | if( p_mlib->p_mlist ) |
|---|
| 109 | 110 | libvlc_media_list_release( p_mlib->p_mlist ); |
|---|
| r0038469 |
r146dad5 |
|
| 297 | 297 | /* Set the config file stuff */ |
|---|
| 298 | 298 | p_libvlc->psz_homedir = config_GetHomeDir(); |
|---|
| 299 | | priv->psz_datadir = config_GetUserDataDir(); |
|---|
| 300 | 299 | priv->psz_configfile = config_GetCustomConfigFile( p_libvlc ); |
|---|
| 301 | 300 | |
|---|
| … | … | |
| 1061 | 1060 | |
|---|
| 1062 | 1061 | FREENULL( p_libvlc->psz_homedir ); |
|---|
| 1063 | | free( priv->psz_datadir ); |
|---|
| 1064 | 1062 | FREENULL( priv->psz_configfile ); |
|---|
| 1065 | 1063 | var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action, |
|---|
| r0038469 |
r146dad5 |
|
| 212 | 212 | vlc_mutex_t config_lock; ///< config file lock |
|---|
| 213 | 213 | char * psz_configfile; ///< location of config file |
|---|
| 214 | | char *psz_datadir; ///< user data directory |
|---|
| 215 | 214 | |
|---|
| 216 | 215 | /* There is no real reason to keep a list of items, but not to break |
|---|
| rd6a7e48 |
r146dad5 |
|
| 109 | 109 | int playlist_MLLoad( playlist_t *p_playlist ) |
|---|
| 110 | 110 | { |
|---|
| 111 | | const char *psz_datadir = libvlc_priv (p_playlist->p_libvlc)->psz_datadir; |
|---|
| | 111 | char *psz_datadir = config_GetUserDataDir(); |
|---|
| 112 | 112 | char *psz_uri = NULL; |
|---|
| 113 | 113 | input_item_t *p_input; |
|---|
| … | … | |
| 128 | 128 | /* checks if media library file is present */ |
|---|
| 129 | 129 | if( utf8_stat( psz_uri , &p_stat ) ) |
|---|
| 130 | | { |
|---|
| 131 | | free( psz_uri ); |
|---|
| 132 | | return VLC_EGENERIC; |
|---|
| 133 | | } |
|---|
| | 130 | goto error; |
|---|
| 134 | 131 | free( psz_uri ); |
|---|
| 135 | 132 | |
|---|
| | 133 | /* FIXME: WTF? stat() should never be used right before open()! */ |
|---|
| 136 | 134 | if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xspf", |
|---|
| 137 | 135 | psz_datadir ) == -1 ) |
|---|
| … | … | |
| 140 | 138 | goto error; |
|---|
| 141 | 139 | } |
|---|
| | 140 | free( psz_datadir ); |
|---|
| | 141 | psz_datadir = NULL; |
|---|
| 142 | 142 | |
|---|
| 143 | 143 | const char *const psz_option = "meta-file"; |
|---|
| … | … | |
| 184 | 184 | error: |
|---|
| 185 | 185 | free( psz_uri ); |
|---|
| | 186 | free( psz_datadir ); |
|---|
| 186 | 187 | return VLC_ENOMEM; |
|---|
| 187 | 188 | } |
|---|
| … | … | |
| 189 | 190 | int playlist_MLDump( playlist_t *p_playlist ) |
|---|
| 190 | 191 | { |
|---|
| 191 | | char *psz_datadir = libvlc_priv (p_playlist->p_libvlc)->psz_datadir; |
|---|
| | 192 | char *psz_datadir = config_GetUserDataDir(); |
|---|
| 192 | 193 | if( !config_GetInt( p_playlist, "media-library") ) return VLC_SUCCESS; |
|---|
| 193 | 194 | if( !psz_datadir ) /* XXX: This should never happen */ |
|---|
| … | … | |
| 199 | 200 | char psz_dirname[ strlen( psz_datadir ) + sizeof( DIR_SEP "ml.xspf")]; |
|---|
| 200 | 201 | strcpy( psz_dirname, psz_datadir ); |
|---|
| | 202 | free( psz_datadir ); |
|---|
| 201 | 203 | if( config_CreateDir( (vlc_object_t *)p_playlist, psz_dirname ) ) |
|---|
| 202 | 204 | { |
|---|
| rd6a7e48 |
r146dad5 |
|
| 638 | 638 | /* XXX: This saves in the data directory. Shouldn't we try saving |
|---|
| 639 | 639 | * to psz_homedir/Desktop or something nicer ? */ |
|---|
| 640 | | if( !val.psz_string && libvlc_priv (p_vout->p_libvlc)->psz_datadir ) |
|---|
| 641 | | { |
|---|
| 642 | | if( asprintf( &val.psz_string, "%s", |
|---|
| 643 | | libvlc_priv (p_vout->p_libvlc)->psz_datadir ) == -1 ) |
|---|
| | 640 | char *psz_datadir = config_GetUserDataDir(); |
|---|
| | 641 | if( !val.psz_string && psz_datadir ) |
|---|
| | 642 | { |
|---|
| | 643 | if( asprintf( &val.psz_string, "%s", psz_datadir ) == -1 ) |
|---|
| 644 | 644 | val.psz_string = NULL; |
|---|
| 645 | 645 | } |
|---|
| | 646 | free( psz_datadir ); |
|---|
| 646 | 647 | #endif |
|---|
| 647 | 648 | |
|---|