diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libical-glib/api/i-cal-timezone.xml | 4 | ||||
-rw-r--r-- | src/libical/icaltimezone.c | 19 | ||||
-rw-r--r-- | src/libical/icaltimezone.h | 3 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/libical-glib/api/i-cal-timezone.xml b/src/libical-glib/api/i-cal-timezone.xml index 0de66874..5dc47109 100644 --- a/src/libical-glib/api/i-cal-timezone.xml +++ b/src/libical-glib/api/i-cal-timezone.xml @@ -172,6 +172,10 @@ <returns type="gchar *" comment="The name of vtimezone."/> <comment xml:space="preserve">Gets the name of the vtimezone in component.</comment> </method> + <method name="i_cal_timezone_get_zone_directory" corresponds="get_zone_directory" kind="others" since="3.0.17"> + <returns type="const gchar *" comment="The path to look for the zonefiles"/> + <comment xml:space="preserve">Gets the directory to look for the zonefiles.</comment> + </method> <method name="i_cal_timezone_set_zone_directory" corresponds="set_zone_directory" kind="others" since="1.0"> <parameter type="const gchar *" name="path" comment="The path to look for the zonefiles"/> <comment xml:space="preserve">Sets the directory to look for the zonefiles.</comment> diff --git a/src/libical/icaltimezone.c b/src/libical/icaltimezone.c index f4f53c61..a93e224c 100644 --- a/src/libical/icaltimezone.c +++ b/src/libical/icaltimezone.c @@ -162,7 +162,7 @@ static void icaltimezone_parse_zone_tab(void); static char *icaltimezone_load_get_line_fn(char *s, size_t size, void *data); static void format_utc_offset(int utc_offset, char *buffer, size_t buffer_size); -static const char *get_zone_directory(void); +static const char *get_zone_directory_builtin(void); static void icaltimezone_builtin_lock(void) { @@ -1678,7 +1678,7 @@ static void icaltimezone_parse_zone_tab(void) zonedir = icaltzutil_get_zone_directory(); zonetab = ZONES_TAB_SYSTEM_FILENAME; } else { - zonedir = get_zone_directory(); + zonedir = get_zone_directory_builtin(); zonetab = ZONES_TAB_FILENAME; } @@ -1829,7 +1829,7 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone) FILE *fp; icalparser *parser; - filename_len = strlen(get_zone_directory()) + strlen(zone->location) + 6; + filename_len = strlen(get_zone_directory_builtin()) + strlen(zone->location) + 6; filename = (char *)icalmemory_new_buffer(filename_len); if (!filename) { @@ -1837,7 +1837,7 @@ static void icaltimezone_load_builtin_timezone(icaltimezone *zone) goto out; } - snprintf(filename, filename_len, "%s/%s.ics", get_zone_directory(), zone->location); + snprintf(filename, filename_len, "%s/%s.ics", get_zone_directory_builtin(), zone->location); fp = fopen(filename, "r"); icalmemory_free_buffer(filename); @@ -2006,7 +2006,7 @@ static void format_utc_offset(int utc_offset, char *buffer, size_t buffer_size) } } -static const char *get_zone_directory(void) +static const char *get_zone_directory_builtin(void) { #if !defined(_WIN32) return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory; @@ -2141,6 +2141,15 @@ static const char *get_zone_directory(void) #endif } +const char *get_zone_directory(void) +{ + if (use_builtin_tzdata) { + return get_zone_directory_builtin(); + } else { + return icaltzutil_get_zone_directory(); + } +} + void set_zone_directory(const char *path) { if (zone_files_directory) diff --git a/src/libical/icaltimezone.h b/src/libical/icaltimezone.h index 01677150..b4feb10f 100644 --- a/src/libical/icaltimezone.h +++ b/src/libical/icaltimezone.h @@ -191,6 +191,9 @@ LIBICAL_ICAL_EXPORT void icaltimezone_truncate_vtimezone(icalcomponent *vtz, * @par Handling the default location the timezone files */ +/** Gets the directory to look for the zonefiles */ +LIBICAL_ICAL_EXPORT const char *get_zone_directory(void); + /** Sets the directory to look for the zonefiles */ LIBICAL_ICAL_EXPORT void set_zone_directory(const char *path); |