Fixes opening video files on Windows. [#30752]
Thanks Lockal for finding faulty stat function which helped a lot. Now there BLI_stat. I will replace all other stat later. *** Please use BLI_xxxx() functions *** for file operations Reported by Leon Cheung, Lockal, Believil
This commit is contained in:
@@ -55,6 +55,7 @@ int BLI_rename(const char *from, const char *to);
|
||||
int BLI_delete(const char *path, int dir, int recursive);
|
||||
int BLI_move(const char *path, const char *to);
|
||||
int BLI_create_symlink(const char *path, const char *to);
|
||||
int BLI_stat(const char *path, struct stat *buffer);
|
||||
|
||||
/* Directories */
|
||||
|
||||
|
@@ -493,6 +493,23 @@ int BLI_exists(const char *name)
|
||||
return(st.st_mode);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
int BLI_stat(const char *path, struct stat *buffer)
|
||||
{
|
||||
int r;
|
||||
UTF16_ENCODE(path);
|
||||
r=_wstat(path_16,buffer);
|
||||
UTF16_UN_ENCODE(path);
|
||||
return r;
|
||||
}
|
||||
#else
|
||||
int BLI_stat(const char *path, struct stat *buffer)
|
||||
{
|
||||
return stat(path, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* would be better in fileops.c except that it needs stat.h so add here */
|
||||
int BLI_is_dir(const char *file)
|
||||
{
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#endif
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -342,14 +343,14 @@ int imb_get_anim_type(const char * name)
|
||||
/* stat test below fails on large files > 4GB */
|
||||
if (isffmpeg(name)) return (ANIM_FFMPEG);
|
||||
# endif
|
||||
if (stat(name, &st) == -1) return(0);
|
||||
if (BLI_stat(name, &st) == -1) return(0);
|
||||
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
|
||||
|
||||
if (isavi(name)) return (ANIM_AVI);
|
||||
|
||||
if (ismovie(name)) return (ANIM_MOVIE);
|
||||
#else
|
||||
if (stat(name, &st) == -1) return(0);
|
||||
if (BLI_stat(name, &st) == -1) return(0);
|
||||
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
|
||||
|
||||
if (ismovie(name)) return (ANIM_MOVIE);
|
||||
@@ -359,6 +360,8 @@ int imb_get_anim_type(const char * name)
|
||||
# ifdef WITH_FFMPEG
|
||||
if (isffmpeg(name)) return (ANIM_FFMPEG);
|
||||
# endif
|
||||
|
||||
|
||||
if (isavi(name)) return (ANIM_AVI);
|
||||
#endif
|
||||
#ifdef WITH_REDCODE
|
||||
|
Reference in New Issue
Block a user