Re: [PATCHES] display and expression of the home directory in Win32
From: "Magnus Hagander" HOMEDIR = "C:/Documents and Settings/saito/Application Data/postgresql" VERSION = PostgreSQL 8.1.1 HOMEDIR is a very bad name for this variable, since it's *not* the home directory. It could easily be confused. If we put it in, I definitly think it should be called something else.. (USERCONFDIR based on that we Um, About a name, I think that it is right. have SYSCONFDIR, perhaps?). Also, there is no reason not to include it on Unix as well - it would actrually be much better to do that, in case someone wants to write a script that relies on it. It will be good to be clearly shown in all environments. dir "C:/Documents and Settings/saito/Application Data/postgresql" This would then be: dir "%APPDATA%\postgresql" which is actually much easier to use than getting it from pg_config, since you can use the environment variable in any command you want. Probably, there is a user who notices after the directory is shown. Regards, Hiroshi Saito ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [PATCHES] display and expression of the home directory in Win32
> I receive an inquiry from a user frequently. Where is it > about a home directory in a place? Then, In offer of the > initial state of Windows, the place is hidden and is not > visible to a user. I considered what can be offered this way > and that. Then, using pg_config thinks that it is good. > > This patch show a user a clear place. Please take this into > consideration. > > F:\postgresql-8.1.2stable\src\bin\pg_config\Release>pg_config.exe > BINDIR = F:/postgresql-8.1.2stable/src/bin/pg_config/Release > DOCDIR = > INCLUDEDIR = > PKGINCLUDEDIR = > INCLUDEDIR-SERVER = > LIBDIR = > PKGLIBDIR = > LOCALEDIR = > MANDIR = > SHAREDIR = > SYSCONFDIR = > PGXS = /pgxs/src/makefiles/pgxs.mk > HOMEDIR = "C:/Documents and Settings/saito/Application > Data/postgresql" > VERSION = PostgreSQL 8.1.1 HOMEDIR is a very bad name for this variable, since it's *not* the home directory. It could easily be confused. If we put it in, I definitly think it should be called something else.. (USERCONFDIR based on that we have SYSCONFDIR, perhaps?). Also, there is no reason not to include it on Unix as well - it would actrually be much better to do that, in case someone wants to write a script that relies on it. I'm also not sure this really buys us buch. There is already an environment variable that points to this (unless you've applied some very unusual modifications to your windows installation, in which case you probably know where to be looking anyway), and that is: %APPDATA%\postgresql > dir "C:/Documents and Settings/saito/Application Data/postgresql" This would then be: dir "%APPDATA%\postgresql" which is actually much easier to use than getting it from pg_config, since you can use the environment variable in any command you want. //Magnus ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PATCHES] display and expression of the home directory in Win32
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Peter Eisentraut > Sent: 06 January 2006 11:07 > To: pgsql-patches@postgresql.org > Cc: Hiroshi Saito > Subject: Re: [PATCHES] display and expression of the home > directory in Win32 > > Am Freitag, 6. Januar 2006 04:03 schrieb Hiroshi Saito: > [pg_config] > > HOMEDIR = "C:/Documents and Settings/saito/Application > Data/postgresql" > > Where does this come from and what would it be good for? It's not always obvious on Windows where this directory is because apps generally write their files there themselves, thus the user doesn't necessarily even know it exists. Pgpass.conf (which we store there) is a bit of odd case because it may be used by various front-end applications or drivers and may need manual editting. That's not to say I necessarily think it should be added to pg_config - I could be persuaded either way. Regards, Dave. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [PATCHES] display and expression of the home directory in Win32
Am Freitag, 6. Januar 2006 04:03 schrieb Hiroshi Saito: [pg_config] > HOMEDIR = "C:/Documents and Settings/saito/Application Data/postgresql" Where does this come from and what would it be good for? ---(end of broadcast)--- TIP 6: explain analyze is your friend
[PATCHES] display and expression of the home directory in Win32
Dear Bruce san. I receive an inquiry from a user frequently. Where is it about a home directory in a place? Then, In offer of the initial state of Windows, the place is hidden and is not visible to a user. I considered what can be offered this way and that. Then, using pg_config thinks that it is good. This patch show a user a clear place. Please take this into consideration. F:\postgresql-8.1.2stable\src\bin\pg_config\Release>pg_config.exe BINDIR = F:/postgresql-8.1.2stable/src/bin/pg_config/Release DOCDIR = INCLUDEDIR = PKGINCLUDEDIR = INCLUDEDIR-SERVER = LIBDIR = PKGLIBDIR = LOCALEDIR = MANDIR = SHAREDIR = SYSCONFDIR = PGXS = /pgxs/src/makefiles/pgxs.mk HOMEDIR = "C:/Documents and Settings/saito/Application Data/postgresql" VERSION = PostgreSQL 8.1.1 dir "C:/Documents and Settings/saito/Application Data/postgresql" 2005/08/10 11:19 . 2005/08/10 11:19 .. 2005/08/10 11:19 0 pgpass.conf 2005/01/13 00:00 3,520 postgresql.crt 2005/01/13 00:00 891 postgresql.key Regards, Hiroshi Saito --- 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) +{ + charhomedir[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(_(" --libsshow 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(_(" --helpshow this help, then exit\n")); printf(_("\nWith no arguments, all known items are shown.\n\n")); ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly