Skip to content

Commit

Permalink
Use fl_stat for better Windows UTF-16 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Sep 23, 2021
1 parent e4876ce commit 9539cf2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,18 @@ bool file_exists(const char *f) {
}

size_t file_size(const char *f) {
#ifdef __CYGWIN__
#define stat64 stat
#elif defined(_WIN32)
#define stat64 _stat32i64
#endif
struct stat64 s;
int r = stat64(f, &s);
struct stat s;
int r = fl_stat(f, &s);
return r ? 0 : (size_t)s.st_size;
}

size_t file_size(FILE *f) {
#ifdef __CYGWIN__
#define stat64 stat
#define fstat64 fstat
#elif defined(_WIN32)
#define fileno _fileno
#define stat64 _stat32i64
#define fstat64 _fstat32i64
#endif
struct stat64 s;
Expand Down

0 comments on commit 9539cf2

Please sign in to comment.