Skip to content

Commit

Permalink
fixed: MacOS compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanfh committed Jan 18, 2024
1 parent 4ea3958 commit 5e22b0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shared/include/bh.h
Original file line number Diff line number Diff line change
Expand Up @@ -1919,9 +1919,17 @@ b32 bh_file_stat(char const* filename, bh_file_stats* out) {
}

out->size = s.st_size;

#if defined(_BH_DARWIN)
// Apple just has to be different.
out->modified_time = timespec_to_ms(s.st_mtimespec);
out->accessed_time = timespec_to_ms(s.st_atimespec);
out->change_time = timespec_to_ms(s.st_ctimespec);
#else
out->modified_time = timespec_to_ms(s.st_mtim);
out->accessed_time = timespec_to_ms(s.st_atim);
out->change_time = timespec_to_ms(s.st_ctim);
#endif

if ((s.st_mode & S_IFMT) == S_IFDIR) out->file_type = BH_FILE_TYPE_DIRECTORY;
if ((s.st_mode & S_IFMT) == S_IFREG) out->file_type = BH_FILE_TYPE_FILE;
Expand Down

0 comments on commit 5e22b0d

Please sign in to comment.