Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
vor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
code formatting: indentation, arg name
[vor.git]
/
file.c
diff --git
a/file.c
b/file.c
index
40d11fa
..
efd08e5
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-26,7
+26,7
@@
#include <unistd.h>
#include "common.h"
#include <unistd.h>
#include "common.h"
-#include "config.h"
+#include "vorconfig.h"
#include "file.h"
#ifdef WIN32
#include "file.h"
#ifdef WIN32
@@
-91,11
+91,23
@@
static bool
is_dir(char *dirname)
{
struct stat buf;
is_dir(char *dirname)
{
struct stat buf;
- stat(dirname, &buf);
+ if(stat(dirname, &buf)) {
+ return false;
+ }
return S_ISDIR(buf.st_mode);
}
static bool
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;
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]);
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");
}
fprintf(stderr, "Can't find VoR data! Tried:\n");