From ce1034dd612a3166281403f829a368e9ada3411d Mon Sep 17 00:00:00 2001 From: frosty Date: Sun, 15 Mar 2026 00:06:45 -0400 Subject: feature: added missing file checks --- src/main.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main.c b/src/main.c index eadda29..0c5ca32 100755 --- a/src/main.c +++ b/src/main.c @@ -3,7 +3,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -17,6 +19,30 @@ bool running=true; #define PROJECT_NAME "dacctal fish" +static int file_exists(const char *path) { + struct stat st; + return stat(path, &st) == 0; +} + +static void check_assets(void) { + int missing = 0; + if (!file_exists(fontfile)) { + SDL_LogWarn(0, "Missing: %s", fontfile); + missing++; + } + if (!file_exists(fishimg)) { + SDL_LogWarn(0, "Missing: %s", fishimg); + missing++; + } + if (!file_exists("patreons.txt")) { + SDL_LogWarn(0, "Missing: patreons.txt"); + missing++; + } + if (missing > 0) { + exit(EXIT_FAILURE); + } +} + int main(int argc, char *argv[]) { if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) @@ -26,6 +52,8 @@ int main(int argc, char *argv[]) SDL_Log("SDL fails to initialize ttf! %s\n", SDL_GetError()); } + check_assets(); + int startw=1920; int starth=1080; -- cgit v1.3