X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=file.c;h=efd08e5a0f23ac78f9444312349de8779c8ce4d8;hp=40d11fa4e81c9861400ac21548aded86feac4243;hb=HEAD;hpb=dec36530097c5de6981ca8a302d22523a1cf6f44 diff --git a/file.c b/file.c index 40d11fa..5f6204d 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 @@ -52,7 +52,8 @@ find_files(void) return true; } -FILE *open_score_file(char *mode) +FILE * +open_score_file(char *mode) { return fopen("scores", mode); } @@ -91,11 +92,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 *filename) +{ + struct stat buf; + if(stat(filename, &buf)) { + return false; + } + return S_ISREG(buf.st_mode); +} + +static bool find_data_dir(void) { int i; @@ -108,7 +121,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");