From b394e31f0a8484e43e52bbdbeb417207b1ce97a9 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 1 Apr 2014 08:15:10 +0200 Subject: [PATCH] Add function gswe_init_with_dir() This is to be able to specify the SWE data files' path --- src/swe-glib.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/swe-glib.c b/src/swe-glib.c index 9a6cd70..63d06c4 100644 --- a/src/swe-glib.c +++ b/src/swe-glib.c @@ -106,13 +106,14 @@ gswe_error_quark(void) #endif /** - * gswe_init: + * gswe_init_with_dir: + * @directory: the path that contains the Swiss Ephemeris data files * - * Initializes the SWE-GLib library. It must be called before any calculations - * are made. + * Initializes the SWE-GLib library with @directory as the Swiss Ephemeris + * data files' location. This, or gswe_init() must be called before any + * calculations are made. */ -void -gswe_init(void) +void gswe_init_with_dir(gchar *directory) { GswePlanetInfo *planet_info; GsweSignInfo *sign_info; @@ -210,8 +211,21 @@ gswe_init(void) gswe_full_moon_base_date = gswe_timestamp_new_from_gregorian_full(2005, 5, 8, 3, 48, 0, 0, 0.0); - gswe_ephe_path = g_strdup(PKGDATADIR); - swe_set_ephe_path(PKGDATADIR); + gswe_ephe_path = g_strdup(directory); + g_print("Starting with %s\n", directory); + swe_set_ephe_path(directory); gswe_initialized = TRUE; } +/** + * gswe_init: + * + * Initializes the SWE-GLib library. It must be called before any calculations + * are made. + */ +void +gswe_init(void) +{ + gswe_init_with_dir(PKGDATADIR); +} +