X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=file.c;h=5ce183fc36e57ecba0919a3782e2acf4eb901461;hp=40d11fa4e81c9861400ac21548aded86feac4243;hb=2ca8ac198d86668e1d6e517974354870c32ad70f;hpb=dec36530097c5de6981ca8a302d22523a1cf6f44 diff --git a/file.c b/file.c index 40d11fa..5ce183f 100644 --- a/file.c +++ b/file.c @@ -26,7 +26,7 @@ #include #include "common.h" -#include "config.h" +#include "vorconfig.h" #include "file.h" #ifdef WIN32 @@ -91,11 +91,23 @@ static bool is_dir(char *dirname) { struct stat buf; - stat(dirname, &buf); + if(stat(dirname, &buf)) { + return false; + } return S_ISDIR(buf.st_mode); } static bool +is_file(char *dirname) +{ + struct stat buf; + if(stat(dirname, &buf)) { + return false; + } + return S_ISREG(buf.st_mode); +} + +static bool find_data_dir(void) { int i; @@ -108,7 +120,11 @@ find_data_dir(void) for(i=0; i<3; i++) { if(!data_options[i]) continue; g_data_dir = strdup(data_options[i]); - if(is_dir(g_data_dir)) return true; + if(is_dir(g_data_dir)) { + char *s = add_path(g_data_dir, "b_variations.png"); + if(s) if(is_file(s)) + return true; + } } fprintf(stderr, "Can't find VoR data! Tried:\n");