summaryrefslogtreecommitdiff
path: root/src/timezone/pgtz.c
blob: 7bb789340b98a9916c1ebc95bca71e8e7291840d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*-------------------------------------------------------------------------
 *
 * pgtz.c
 *    Timezone Library Integration Functions
 *
 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
 *	  $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.1 2004/04/30 04:09:23 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */

#include "pgtz.h"
#include "tzfile.h"


#ifdef WIN32
static char tzdir[MAXPGPATH];
static int done_tzdir = 0;
char *pgwin32_TZDIR(void) {
	char *p;
	if (done_tzdir)
		return tzdir;

	if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
		return NULL;
	
	canonicalize_path(tzdir);
	if ((p = last_path_separator(tzdir)) == NULL)
		return NULL;
	else
		*p = '\0';
	
	strcat(tzdir,"/../share/timezone");

	done_tzdir=1;
	return tzdir;
}
#else
#error pgwin32_TZDIR not implemented on non win32 yet!
#endif