summaryrefslogtreecommitdiff
path: root/src/trg-peers-model.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <alan@eth0.org.uk>2012-06-21 14:50:40 +0100
committerGravatar Alan Fitton <alan@eth0.org.uk>2012-06-21 14:50:40 +0100
commit0ec76e53cdb0b15da1dd14bb1c53134dc1f3a55b (patch)
treefc26cf0d4eaaf70d5c89988634c809869d208b67 /src/trg-peers-model.c
parentccd86becdc2c9311e4faac65aff76f7aa0e68a78 (diff)
some changes and hacks to get GeoIP on Windows
Diffstat (limited to 'src/trg-peers-model.c')
-rw-r--r--src/trg-peers-model.c20
1 files changed, 16 insertions, 4 deletions
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
}