--- src/bin/pg_config/pg_config.c.orig Fri Jan 6 10:16:56 2006 +++ src/bin/pg_config/pg_config.c Fri Jan 6 10:49:23 2006 @@ -29,6 +29,17 @@ static const char *progname; static char mypath[MAXPGPATH]; +#ifdef WIN32 +#ifdef _WIN32_IE +#undef _WIN32_IE +#endif +#define _WIN32_IE 0x0500 +#ifdef near +#undef near +#endif +#define near +#include +#endif /* * This function cleans up the paths for use with either cmd.exe or Msys @@ -47,6 +58,7 @@ #ifdef WIN32 char *ptr; +#ifndef WIN32_CLIENT_ONLY if (GetShortPathName(path, path, MAXPGPATH - 1) == 0) { /* @@ -59,7 +71,7 @@ return; } } - +#endif /* !WIN32_CLIENT_ONLY */ /* Replace '\' with '/' */ for (ptr = path; *ptr; ptr++) { @@ -364,6 +376,25 @@ printf("PostgreSQL " PG_VERSION "\n"); } +#ifdef WIN32 +static void +show_homedir(bool all) +{ + char homedir[MAXPGPATH]; + + if (all) + printf("HOMEDIR = "); + + ZeroMemory(homedir, sizeof(homedir)); + SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, homedir); + cleanup_path(homedir); +#ifdef WIN32_CLIENT_ONLY + printf("\"%s/postgresql\"\n", homedir); +#else + printf("%s/postgresql\n", homedir); +#endif +} +#endif /* * Table of known information items @@ -397,6 +428,9 @@ {"--ldflags", show_ldflags}, {"--ldflags_sl", show_ldflags_sl}, {"--libs", show_libs}, +#ifdef WIN32 + {"--homedir", show_homedir}, +#endif {"--version", show_version}, {NULL, NULL} }; @@ -431,6 +465,9 @@ printf(_(" --ldflags show LDFLAGS value used when PostgreSQL was built\n")); printf(_(" --ldflags_sl show LDFLAGS_SL value used when PostgreSQL was built\n")); printf(_(" --libs show LIBS value used when PostgreSQL was built\n")); +#ifdef WIN32 + printf(_(" --homedir show HOME directry of owner user\n")); +#endif printf(_(" --version show the PostgreSQL version\n")); printf(_(" --help show this help, then exit\n")); printf(_("\nWith no arguments, all known items are shown.\n\n"));