From ec2719329c69a3b683065e9972af9c0d618da1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 16 Oct 2009 08:26:56 +0000 Subject: [PATCH] * Fixed timezones directory path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33607 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/time/Jamfile | 3 ++- src/system/libroot/posix/time/localtime.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/time/Jamfile b/src/system/libroot/posix/time/Jamfile index ca90059300..044b245ff2 100644 --- a/src/system/libroot/posix/time/Jamfile +++ b/src/system/libroot/posix/time/Jamfile @@ -1,7 +1,8 @@ SubDir HAIKU_TOP src system libroot posix time ; # for localtime.c strftime.c -SubDirCcFlags -DNOID -DTZDIR='\"/etc/timezones\"' -DUSG_COMPAT -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DPCTS=1 -DSTD_INSPIRED ; +SubDirCcFlags -DNOID -DTZDIR='get_timezones_directory()' -DUSG_COMPAT + -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DPCTS=1 -DSTD_INSPIRED ; UsePrivateHeaders [ FDirName libroot time ] ; UsePrivateSystemHeaders ; diff --git a/src/system/libroot/posix/time/localtime.c b/src/system/libroot/posix/time/localtime.c index b0c724b2ed..aee2df89bf 100644 --- a/src/system/libroot/posix/time/localtime.c +++ b/src/system/libroot/posix/time/localtime.c @@ -226,6 +226,26 @@ int daylight = 0; time_t altzone = 0; #endif /* defined ALTZONE */ +#ifdef __HAIKU__ +# include + +static const char* +get_timezones_directory(void) +{ + static char path[PATH_MAX]; + if (path[0] != '\0') + return path; + + if (find_directory(B_SYSTEM_DATA_DIRECTORY, -1, false, path, sizeof(path)) + == B_OK) { + strlcat(path, "/timezones", sizeof(path)); + } else + strcpy(path, "/boot/system/data/timezones"); + + return path; +} +#endif + static long detzcode(codep) const char * const codep;