#include <assert.h>
#include <vlc_stream.h>
#include <vlc_input.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
/*****************************************************************************
psz_extension = "dat";
/* Retreive path */
- char *psz_path = var_CreateGetString( s, "input-record-path" );
- if( !psz_path || *psz_path == '\0' )
- {
- free( psz_path );
- psz_path = strdup( config_GetHomeDir() );
- }
+ char *psz_path = var_CreateGetNonEmptyString( s, "input-record-path" );
+ if( !psz_path )
+ psz_path = config_GetUserDir( VLC_DOWNLOAD_DIR );
if( !psz_path )
return VLC_ENOMEM;
if( !psz_file )
return VLC_ENOMEM;
- f = utf8_fopen( psz_file, "wb" );
+ f = vlc_fopen( psz_file, "wb" );
if( !f )
{
free( psz_file );
return VLC_EGENERIC;
}
+
+ /* signal new record file */
+ var_SetString( s->p_libvlc, "record-file", psz_file );
+
msg_Dbg( s, "Recording into %s", psz_file );
free( psz_file );