From 0ec76e53cdb0b15da1dd14bb1c53134dc1f3a55b Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Thu, 21 Jun 2012 14:50:40 +0100 Subject: some changes and hacks to get GeoIP on Windows --- src/trg-peers-model.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/trg-peers-model.c') diff --git a/src/trg-peers-model.c b/src/trg-peers-model.c index ad1d021..f812bee 100644 --- a/src/trg-peers-model.c +++ b/src/trg-peers-model.c @@ -246,12 +246,24 @@ static void trg_peers_model_init(TrgPeersModel * self) column_types); #ifdef HAVE_GEOIP - if (g_file_test(TRG_GEOIP_DATABASE, G_FILE_TEST_EXISTS) == TRUE) - priv->geoip = GeoIP_open(TRG_GEOIP_DATABASE, +#ifdef WIN32 + gchar *geoip_db_path = trg_win32_support_path("GeoIP.dat"); + gchar *geoip_v6_db_path = trg_win32_support_path("GeoIP.dat"); +#else + gchar *geoip_db_path = g_strdup(TRG_GEOIP_DATABASE); + gchar *geoip_v6_db_path = g_strdup(TRG_GEOIPV6_DATABASE); +#endif + + if (g_file_test(geoip_db_path, G_FILE_TEST_EXISTS) == TRUE) + priv->geoip = GeoIP_open(geoip_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); - if (g_file_test(TRG_GEOIPV6_DATABASE, G_FILE_TEST_EXISTS) == TRUE) - priv->geoipv6 = GeoIP_open(TRG_GEOIPV6_DATABASE, + + if (g_file_test(geoip_v6_db_path, G_FILE_TEST_EXISTS) == TRUE) + priv->geoipv6 = GeoIP_open(geoip_v6_db_path, GEOIP_STANDARD | GEOIP_CHECK_CACHE); + + g_free(geoip_db_path); + g_free(geoip_v6_db_path); #endif } -- cgit v1.2.3