From: Daniel Elstner Date: Sat, 3 Oct 2015 11:58:50 +0000 (+0200) Subject: resource: Make definition of FIRMWARE_DIR optional X-Git-Tag: libsigrok-0.4.0~234 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=127c9cec824721bf52e8951f330d1d5a16c1a9b0;p=libsigrok.git resource: Make definition of FIRMWARE_DIR optional --- diff --git a/src/resource.c b/src/resource.c index bcb7a191..bf28169b 100644 --- a/src/resource.c +++ b/src/resource.c @@ -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)