From a96111c8026d47147708796091ec7bef216aefd8 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Thu, 7 Mar 2019 14:43:51 -0600 Subject: update code to allow you to run the fit outside of the src directory To enable the fitter to run outside of the src directory, I created a new function open_file() which works exactly like fopen() except that it searches for the file in both the current working directory and the path specified by an environment variable. --- src/db.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/db.c') diff --git a/src/db.c b/src/db.c index c94eaba..d364503 100644 --- a/src/db.c +++ b/src/db.c @@ -5,6 +5,7 @@ #include /* for uint32_t */ #include /* for atoi() */ #include "dict.h" +#include "util.h" char db_err[256]; @@ -147,7 +148,7 @@ int load_file(dict *db, const char *filename) return -1; } - FILE *f = fopen(filename, "r"); + FILE *f = open_file(filename, "r"); if (!f) { sprintf(db_err, "unable to open file '%s': %s", filename, strerror(errno)); -- cgit