Skip to content

Commit

Permalink
MTY_GetFileList size fix on unix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisd1100 committed Jan 31, 2024
1 parent c933d8d commit 5a5614d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/unix/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,14 @@ MTY_FileList *MTY_GetFileList(const char *path, const char *filter)
if (is_dir || MTY_StrSearch(name, filter ? filter : "", "|")) {
fl->files = MTY_Realloc(fl->files, fl->len + 1, sizeof(MTY_FileDesc));

char *jpath = MTY_Strdup(MTY_JoinPath(pathd, name));

fl->files[fl->len].dir = is_dir;
fl->files[fl->len].name = MTY_Strdup(name);
fl->files[fl->len].path = MTY_Strdup(MTY_JoinPath(pathd, name));
fl->files[fl->len].path = jpath;

struct stat st;
if (!is_dir && stat(name, &st) == 0)
if (!is_dir && stat(jpath, &st) == 0)
fl->files[fl->len].size = st.st_size;

fl->len++;
Expand Down

0 comments on commit 5a5614d

Please sign in to comment.