-#elif defined(UNDER_CE)
-
-#ifndef CSIDL_APPDATA
-# define CSIDL_APPDATA 0x1A
-#endif
-
- wchar_t whomedir[MAX_PATH];
-
- /* get the "Application Data" folder for the current user */
- if( SHGetSpecialFolderPath( NULL, whomedir, CSIDL_APPDATA, 1 ) )
- return FromWide( whomedir );
-#endif
-
- psz_localhome = getenv( "HOME" );
- if( psz_localhome == NULL )
- {
-#if defined(HAVE_GETPWUID)
- struct passwd *p_pw;
- (void)b_appdata;
-
- if( ( p_pw = getpwuid( getuid() ) ) != NULL )
- psz_localhome = p_pw->pw_dir;
- else
-#endif
- {
- psz_localhome = getenv( "TMP" );
- if( psz_localhome == NULL )
- psz_localhome = "/tmp";
- }
- }
-
- return FromLocaleDup( psz_localhome );
-}
-
-/**
- * Get the user's home directory
- */
-char *config_GetHomeDir( void )
-{
- return GetDir( VLC_FALSE );
-}
-
-/**
- * Get the user's main data and config directory:
- * - on windows that's the App Data directory;
- * - on other OSes it's the same as the home directory.
- */
-char *config_GetUserDir( void );
-char *config_GetUserDir( void )
-{
- return GetDir( VLC_TRUE );
-}
-
-/**
- * Get the user's VLC configuration directory
- */
-char *config_GetConfigDir( libvlc_int_t *p_libvlc )
-{
- char *psz_dir;
-#if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
- char *psz_parent = config_GetUserDir();
- if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
- if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
- return NULL;
- return psz_dir;
-#else
- /* XDG Base Directory Specification - Version 0.6 */
- char *psz_env = getenv( "XDG_CONFIG_HOME" );
- if( psz_env )
- {
- if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
- }
- psz_env = getenv( "HOME" );
- if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
- if( asprintf( &psz_dir, "%s/.config/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
-#endif
-}
-
-/**
- * Get the user's VLC data directory
- * (used for stuff like the skins, custom lua modules, ...)
- */
-char *config_GetUserDataDir( libvlc_int_t *p_libvlc )
-{
- char *psz_dir;
-#if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
- char *psz_parent = config_GetUserDir();
- if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
- if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
- return NULL;
- return psz_dir;
-#else
- /* XDG Base Directory Specification - Version 0.6 */
- char *psz_env = getenv( "XDG_DATA_HOME" );
- if( psz_env )
- {
- if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
- }
- psz_env = getenv( "HOME" );
- if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
- if( asprintf( &psz_dir, "%s/.local/share/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
-#endif
-}
-
-/**
- * Get the user's VLC cache directory
- * (used for stuff like the modules cache, the album art cache, ...)
- */
-char *config_GetCacheDir( libvlc_int_t *p_libvlc )
-{
- char *psz_dir;
-#if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS)
- char *psz_parent = config_GetUserDir();
- if( !psz_parent ) psz_parent = p_libvlc->psz_homedir;
- if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 )
- return NULL;
- return psz_dir;
-#else
- /* XDG Base Directory Specification - Version 0.6 */
- char *psz_env = getenv( "XDG_CACHE_HOME" );
- if( psz_env )
- {
- if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
- }
- psz_env = getenv( "HOME" );
- if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */
- if( asprintf( &psz_dir, "%s/.cache/vlc", psz_env ) == -1 )
- return NULL;
- return psz_dir;
-#endif
-}
-
-/* Adds an extra interface to the configuration */
-void __config_AddIntf( vlc_object_t *p_this, const char *psz_intf )
-{
- assert( psz_intf );
-
- char *psz_config, *psz_parser;
- size_t i_len = strlen( psz_intf );
-
- psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "control" );
- while( psz_parser )
- {
- if( !strncmp( psz_intf, psz_parser, i_len ) )
- {
- free( psz_config );
- return;
- }
- psz_parser = strchr( psz_parser, ':' );
- if( psz_parser ) psz_parser++; /* skip the ':' */
- }
- free( psz_config );
-
- psz_config = psz_parser = config_GetPsz( p_this->p_libvlc, "extraintf" );
- while( psz_parser )
- {
- if( !strncmp( psz_intf, psz_parser, i_len ) )
- {
- free( psz_config );
- return;
- }
- psz_parser = strchr( psz_parser, ':' );
- if( psz_parser ) psz_parser++; /* skip the ':' */
- }
-
- /* interface not found in the config, let's add it */
- if( psz_config && strlen( psz_config ) > 0 )
- {
- char *psz_newconfig;
- if( asprintf( &psz_newconfig, "%s:%s", psz_config, psz_intf ) != -1 )
- {
- config_PutPsz( p_this->p_libvlc, "extraintf", psz_newconfig );
- free( psz_newconfig );
- }
- }
- else
- config_PutPsz( p_this->p_libvlc, "extraintf", psz_intf );
-
- free( psz_config );