From 71cf50254f065cc3815f280b162a492fde124949 Mon Sep 17 00:00:00 2001 From: ciscon Date: Thu, 14 Mar 2024 13:00:29 -0400 Subject: [PATCH] DEMOS: do not list empty demo files --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index f5c8ab4..b9f26a7 100644 --- a/src/main.c +++ b/src/main.c @@ -70,6 +70,9 @@ void Cluster_BuildAvailableDemoList(cluster_t *cluster) if (cluster->availdemoscount == sizeof(cluster->availdemos)/sizeof(cluster->availdemos[0])) break; + if (ffd.nFileSizeLow == 0) + continue; // Ignore empty files + strlcpy(cluster->availdemos[cluster->availdemoscount].name, ffd.cFileName, sizeof(cluster->availdemos[0].name)); cluster->availdemos[cluster->availdemoscount].size = ffd.nFileSizeLow; cluster->availdemos[cluster->availdemoscount].time = ffd.ftLastWriteTime.dwHighDateTime; @@ -121,6 +124,9 @@ void Cluster_BuildAvailableDemoList(cluster_t *cluster) if (stat(fullname, &sb)) continue; // Some kind of error. + if (sb.st_size == 0) + continue; // Ignore empty files + strlcpy(cluster->availdemos[cluster->availdemoscount].name, ent->d_name, sizeof(cluster->availdemos[0].name)); cluster->availdemos[cluster->availdemoscount].size = sb.st_size; cluster->availdemos[cluster->availdemoscount].time = sb.st_mtime;