diff options
-rw-r--r-- | libhb/ports.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libhb/ports.c b/libhb/ports.c index 64aad0e77..722134780 100644 --- a/libhb/ports.c +++ b/libhb/ports.c @@ -230,10 +230,10 @@ int hb_get_cpu_count() void hb_get_temporary_directory( char path[512] ) { char base[512]; + char *p; /* Create the base */ #if defined( SYS_CYGWIN ) || defined( SYS_MINGW ) - char *p; int i_size = GetTempPath( 512, base ); if( i_size <= 0 || i_size >= 512 ) { @@ -245,7 +245,11 @@ void hb_get_temporary_directory( char path[512] ) while( ( p = strchr( base, '\\' ) ) ) *p = '/'; #else - strcpy( base, "/tmp" ); + if( (p = getenv( "TMPDIR" ) ) != NULL || + (p = getenv( "TEMP" ) ) != NULL ) + strcpy( base, p ); + else + strcpy( base, "/tmp" ); #endif /* I prefer to remove evntual last '/' (for cygwin) */ if( base[strlen(base)-1] == '/' ) |