Commit b3bc5c68 authored by Rafaël Carré's avatar Rafaël Carré

Use $HOME before anything else to determine the home directory. Patch by Benjamin Cama

parent edead8b8
...@@ -1843,25 +1843,23 @@ static char *GetDir( vlc_bool_t b_appdata ) ...@@ -1843,25 +1843,23 @@ static char *GetDir( vlc_bool_t b_appdata )
return FromWide( whomedir ); return FromWide( whomedir );
#endif #endif
psz_localhome = getenv( "HOME" );
if( psz_localhome == NULL )
{
#if defined(HAVE_GETPWUID) #if defined(HAVE_GETPWUID)
struct passwd *p_pw; struct passwd *p_pw;
(void)b_appdata; (void)b_appdata;
if( ( p_pw = getpwuid( getuid() ) ) == NULL ) if( ( p_pw = getpwuid( getuid() ) ) != NULL )
psz_localhome = p_pw->pw_dir;
else
#endif #endif
{
psz_localhome = getenv( "HOME" );
if( psz_localhome == NULL )
{ {
psz_localhome = getenv( "TMP" ); psz_localhome = getenv( "TMP" );
if( psz_localhome == NULL ) if( psz_localhome == NULL )
psz_localhome = "/tmp"; psz_localhome = "/tmp";
} }
} }
#if defined(HAVE_GETPWUID)
else
psz_localhome = p_pw->pw_dir;
#endif
return FromLocaleDup( psz_localhome ); return FromLocaleDup( psz_localhome );
} }
......
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