]> git.sesse.net Git - vlc/blobdiff - modules/access_filter/timeshift.c
videoportals.c: Add support for Daily Motion URLs (the webpage's url).
[vlc] / modules / access_filter / timeshift.c
index 3a988f0167e94439a5eb2e69a7d922109c0de0fa..7ef7dcee46d9ddddb1301cfdd93aa90b94ea54e3 100644 (file)
 /*****************************************************************************
  * 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>
 
@@ -44,7 +46,7 @@ static void Close( vlc_object_t * );
 #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." )
@@ -562,21 +564,25 @@ static char *GetTmpFilePath( access_t *p_access )
     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