/*****************************************************************************
* Preamble
*****************************************************************************/
+#include <vlc/vlc.h>
+
+#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include "charset.h"
+#include <vlc_access.h>
+#include <vlc_charset.h>
#include <unistd.h>
#define GRANULARITY_TEXT N_("Timeshift granularity")
/// \bug [String] typo
#define GRANULARITY_LONGTEXT N_( "This is the size of the temporary files " \
- "tha will be used to store the timeshifted streams." )
+ "that will be used to store the timeshifted streams." )
#define DIR_TEXT N_("Timeshift directory")
#define DIR_LONGTEXT N_( "Directory used to store the timeshift temporary " \
"files." )
if( psz_dir == NULL )
{
#ifdef WIN32
- char psz_local_dir[MAX_PATH];
- int i_size;
+ DWORD ret = GetTempPathW (0, NULL);
+ wchar_t wdir[ret + 3]; // can at least old "C:" + nul
+ const wchar_t *pwdir = wdir;
+ wchar_t *pwdir_free = NULL;
- i_size = GetTempPath( MAX_PATH, psz_local_dir );
- if( i_size <= 0 || i_size > MAX_PATH )
+ if (GetTempPathW (ret + 1, wdir) == 0)
{
- if( !getcwd( psz_local_dir, MAX_PATH ) )
- strcpy( psz_local_dir, "C:" );
+ pwdir_free = pwdir = _wgetcwd (NULL, 0);
+ if (pwdir == NULL)
+ pwdir = L"C:";
}
- psz_dir = FromLocaleDup( psz_local_dir );
+ psz_dir = FromWide (pwdir);
+ if (pwdir_free != NULL)
+ free (pwdir_free);
- /* remove last \\ if any */
- if( psz_dir[strlen(psz_dir)-1] == '\\' )
- psz_dir[strlen(psz_dir)-1] = '\0';
+ /* remove trailing antislash if any */
+ if (psz_dir[strlen (psz_dir) - 1] == '\\')
+ psz_dir[strlen (psz_dir) - 1] = '\0';
#else
psz_dir = strdup( "/tmp" );
#endif