diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-27 20:00:54 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-27 20:00:54 +0100 |
commit | 8731767251de4633b0f8d9e17f6f0e15b5d3ea18 (patch) | |
tree | 35d152f922972f11bcd0aec0f2c864e990fec48d | |
parent | Add patterns for commands (breaks backwards compatbility because libgeome_get_from_netservice was inlined) + add libgeome_get_portability (diff) | |
download | libgeome-8731767251de4633b0f8d9e17f6f0e15b5d3ea18.tar.gz libgeome-8731767251de4633b0f8d9e17f6f0e15b5d3ea18.tar.bz2 libgeome-8731767251de4633b0f8d9e17f6f0e15b5d3ea18.tar.xz |
Add libgeome_default_geolocation_file
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | libgeome.h | 10 | ||||
-rw-r--r-- | libgeome_default_geolocation_file.c | 5 | ||||
-rw-r--r-- | libgeome_get_from_file.c | 2 |
5 files changed, 16 insertions, 3 deletions
@@ -18,6 +18,7 @@ LIB_NAME = geome OBJ =\ libgeome_netservices.o\ + libgeome_default_geolocation_file.o\ libgeome_basic_context.o\ libgeome_get_portability.o\ libgeome_get_from_time.o\ @@ -15,4 +15,3 @@ Add support for more automatic location determination Add geome utility Add support for detecting WiFi and cell towers, using a location service to get a location Add support for detecting changes in nearby WiFi and cell towers -Make default file for libgeome_get_from_file visible to application @@ -246,6 +246,14 @@ extern const struct libgeome_netservice libgeome_netservices[]; */ extern const size_t libgeome_netservices_count; +/** + * The default file for `libgeome_get_from_file` + * + * By default this is `/etc/geolocation`, but it can be + * changed at compile-time + */ +extern const char *const libgeome_default_geolocation_file; + /** * Create a basic initialisation for `struct libgeome_context` @@ -320,7 +328,7 @@ int libgeome_get_from_timezone(struct libgeome_context *ctx, struct libgeome_dat * This function will get both the latitude and * the longitude but nothing more * - * The default file is /etc/geolocation unless changed at compile time + * The default file stored in `libgeome_default_geolocation_file` * * @param ctx Library context * @param out Output parameter, `out->requested_data` must be set diff --git a/libgeome_default_geolocation_file.c b/libgeome_default_geolocation_file.c new file mode 100644 index 0000000..a0d7017 --- /dev/null +++ b/libgeome_default_geolocation_file.c @@ -0,0 +1,5 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +const char *const libgeome_default_geolocation_file = GEOFILE; diff --git a/libgeome_get_from_file.c b/libgeome_get_from_file.c index bbed448..59ad662 100644 --- a/libgeome_get_from_file.c +++ b/libgeome_get_from_file.c @@ -39,7 +39,7 @@ libgeome_get_from_file(struct libgeome_context *ctx, struct libgeome_data *out, int r; if (!path) - path = GEOFILE; + path = libgeome_default_geolocation_file; f = fopen(path, "r"); if (!f) { |