2004-04-30 06:09:23 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* pgtz.c
|
|
|
|
* Timezone Library Integration Functions
|
|
|
|
*
|
|
|
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2004-04-30 22:23:28 +02:00
|
|
|
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.3 2004/04/30 20:23:28 momjian Exp $
|
2004-04-30 06:09:23 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pgtz.h"
|
|
|
|
#include "tzfile.h"
|
|
|
|
|
|
|
|
|
|
|
|
static char tzdir[MAXPGPATH];
|
|
|
|
static int done_tzdir = 0;
|
|
|
|
char *pgwin32_TZDIR(void) {
|
|
|
|
char *p;
|
|
|
|
if (done_tzdir)
|
|
|
|
return tzdir;
|
|
|
|
|
2004-04-30 16:24:14 +02:00
|
|
|
#ifndef WIN32
|
2004-04-30 22:23:28 +02:00
|
|
|
StrNCpy(tzdir, PGDATADIR, MAXPGPATH);
|
2004-04-30 16:24:14 +02:00
|
|
|
#else
|
2004-04-30 06:09:23 +02:00
|
|
|
if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
|
|
|
|
return NULL;
|
2004-04-30 16:24:14 +02:00
|
|
|
#endif
|
2004-04-30 06:09:23 +02:00
|
|
|
|
|
|
|
canonicalize_path(tzdir);
|
|
|
|
if ((p = last_path_separator(tzdir)) == NULL)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
*p = '\0';
|
|
|
|
|
2004-04-30 22:23:28 +02:00
|
|
|
strcat(tzdir,"/timezone");
|
2004-04-30 06:09:23 +02:00
|
|
|
|
|
|
|
done_tzdir=1;
|
|
|
|
return tzdir;
|
|
|
|
}
|