Skip to content

Commit 9539cf2

Browse files
committed
Use fl_stat for better Windows UTF-16 compatibility
1 parent e4876ce commit 9539cf2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/utils.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,18 @@ bool file_exists(const char *f) {
4747
}
4848

4949
size_t file_size(const char *f) {
50-
#ifdef __CYGWIN__
51-
#define stat64 stat
52-
#elif defined(_WIN32)
53-
#define stat64 _stat32i64
54-
#endif
55-
struct stat64 s;
56-
int r = stat64(f, &s);
50+
struct stat s;
51+
int r = fl_stat(f, &s);
5752
return r ? 0 : (size_t)s.st_size;
5853
}
5954

6055
size_t file_size(FILE *f) {
6156
#ifdef __CYGWIN__
57+
#define stat64 stat
6258
#define fstat64 fstat
6359
#elif defined(_WIN32)
6460
#define fileno _fileno
61+
#define stat64 _stat32i64
6562
#define fstat64 _fstat32i64
6663
#endif
6764
struct stat64 s;

0 commit comments

Comments
 (0)