resource: Make definition of FIRMWARE_DIR optional

This commit is contained in:
Daniel Elstner 2015-10-03 13:58:50 +02:00
parent 2c38a41a60
commit 127c9cec82
1 changed files with 8 additions and 2 deletions

View File

@ -99,7 +99,10 @@ static int resource_open_default(struct sr_resource *res,
const char *name, void *cb_data)
{
int64_t filesize;
const char *builtindir, *subdir;
#ifdef FIRMWARE_DIR
const char *builtindir;
#endif
const char *subdir;
const char *const *datadirs;
FILE *file;
@ -107,7 +110,9 @@ static int resource_open_default(struct sr_resource *res,
switch (res->type) {
case SR_RESOURCE_FIRMWARE:
#ifdef FIRMWARE_DIR
builtindir = FIRMWARE_DIR;
#endif
subdir = "sigrok-firmware";
break;
default:
@ -120,9 +125,10 @@ static int resource_open_default(struct sr_resource *res,
* Scan the hard-coded directory before the system directories to
* avoid picking up possibly outdated files from a system install.
*/
#ifdef FIRMWARE_DIR
if (!file)
file = try_open_file(builtindir, "", name);
#endif
if (!file) {
datadirs = g_get_system_data_dirs();
while (*datadirs && !file)