Changeset 46c39c8e9c2e0ec3ba1bf8dc37e6e3e5efb59a08
- Timestamp:
- 05/22/08 20:29:04
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1211480944 +0300
- git-parent:
[b152c831cf6bd6dab1fe8e29859ea85d9f384022]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1211477545 +0300
- Message:
Make config_GetHomeDir return a const string too
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r82921f3 |
r46c39c8 |
|
| 38 | 38 | |
|---|
| 39 | 39 | /* Global properties */ |
|---|
| 40 | | char * psz_homedir; ///< user's home directory |
|---|
| | 40 | const char * psz_homedir; ///< user's home directory |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | global_stats_t *p_stats; ///< Global statistics |
|---|
| r080a076 |
r46c39c8 |
|
| 44 | 44 | |
|---|
| 45 | 45 | int __config_LoadCmdLine ( vlc_object_t *, int *, const char *[], bool ); |
|---|
| 46 | | char *config_GetHomeDir ( void ); |
|---|
| | 46 | const char *config_GetHomeDir ( void ); |
|---|
| 47 | 47 | char *config_GetCustomConfigFile( libvlc_int_t * ); |
|---|
| 48 | 48 | int __config_LoadConfigFile( vlc_object_t *, const char * ); |
|---|
| rb152c83 |
r46c39c8 |
|
| 93 | 93 | static const char *GetDir( bool b_appdata ) |
|---|
| 94 | 94 | { |
|---|
| | 95 | /* FIXME: a full memory page here - quite a waste... */ |
|---|
| 95 | 96 | static char homedir[PATH_MAX] = ""; |
|---|
| 96 | 97 | |
|---|
| … | … | |
| 154 | 155 | * Get the user's home directory |
|---|
| 155 | 156 | */ |
|---|
| 156 | | char *config_GetHomeDir( void ) |
|---|
| 157 | | { |
|---|
| 158 | | return strdup (GetDir( false )); |
|---|
| | 157 | const char *config_GetHomeDir( void ) |
|---|
| | 158 | { |
|---|
| | 159 | return GetDir (false); |
|---|
| 159 | 160 | } |
|---|
| 160 | 161 | |
|---|
| … | … | |
| 163 | 164 | char *psz_dir; |
|---|
| 164 | 165 | #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) |
|---|
| 165 | | char *psz_parent = strdup (GetDir (true)); |
|---|
| | 166 | const char *psz_parent = GetDir (true); |
|---|
| 166 | 167 | |
|---|
| 167 | 168 | if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 ) |
|---|
| 168 | 169 | psz_dir = NULL; |
|---|
| 169 | 170 | |
|---|
| 170 | | free (psz_parent); |
|---|
| 171 | 171 | (void)xdg_name; (void)xdg_default; |
|---|
| 172 | 172 | #else |
|---|
| 173 | 173 | char var[sizeof ("XDG__HOME") + strlen (xdg_name)]; |
|---|
| 174 | | |
|---|
| 175 | 174 | /* XDG Base Directory Specification - Version 0.6 */ |
|---|
| 176 | 175 | snprintf (var, sizeof (var), "XDG_%s_HOME", xdg_name); |
|---|
| 177 | | char *psz_home = getenv( var ); |
|---|
| 178 | | psz_home = psz_home ? FromLocaleDup( psz_home ) : NULL; |
|---|
| | 176 | |
|---|
| | 177 | const char *psz_home = getenv (var); |
|---|
| | 178 | psz_home = psz_home ? FromLocale (psz_home) : NULL; |
|---|
| 179 | 179 | if( psz_home ) |
|---|
| 180 | 180 | { |
|---|
| 181 | 181 | if( asprintf( &psz_dir, "%s/vlc", psz_home ) == -1 ) |
|---|
| 182 | 182 | psz_dir = NULL; |
|---|
| 183 | | goto out; |
|---|
| | 183 | LocaleFree (psz_home); |
|---|
| | 184 | return psz_dir; |
|---|
| 184 | 185 | } |
|---|
| 185 | 186 | |
|---|
| … | … | |
| 188 | 189 | if( asprintf( &psz_dir, "%s/%s/vlc", psz_home, xdg_default ) == -1 ) |
|---|
| 189 | 190 | psz_dir = NULL; |
|---|
| 190 | | |
|---|
| 191 | | out: |
|---|
| 192 | | free (psz_home); |
|---|
| 193 | 191 | #endif |
|---|
| 194 | 192 | return psz_dir; |
|---|
| rf2312da |
r46c39c8 |
|
| 1066 | 1066 | module_EndBank( p_libvlc ); |
|---|
| 1067 | 1067 | |
|---|
| 1068 | | FREENULL( p_libvlc->psz_homedir ); |
|---|
| 1069 | 1068 | FREENULL( priv->psz_configfile ); |
|---|
| 1070 | 1069 | var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action, |
|---|