aboutsummaryrefslogtreecommitdiff
path: root/src/port/path.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-07-12 19:15:14 +0000
committerBruce Momjian <bruce@momjian.us>2004-07-12 19:15:14 +0000
commita4c71af2c01c4a3def06905356f47b99f2a753d1 (patch)
tree9eb7b2e9e6b8802869f5352c6b93860e82c1f953 /src/port/path.c
parent76e7e2e776cca5bb3133c6b0421ce9ba3747b04f (diff)
downloadpostgresql-a4c71af2c01c4a3def06905356f47b99f2a753d1.tar.gz
postgresql-a4c71af2c01c4a3def06905356f47b99f2a753d1.zip
Put back canonicalization of PGDATA environment variable.
Diffstat (limited to 'src/port/path.c')
-rw-r--r--src/port/path.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/port/path.c b/src/port/path.c
index 9a796af4dad..b9958acb746 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.23 2004/07/11 21:34:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.24 2004/07/12 19:15:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,18 +88,17 @@ last_dir_separator(const char *filename)
/*
- * make all paths look like unix, with forward slashes
- * also strip any trailing slash.
- *
- * The Windows command processor will accept suitably quoted paths
- * with forward slashes, but barfs badly with mixed forward and back
- * slashes. Removing the trailing slash on a path means we never get
- * ugly double slashes. Don't remove a leading slash, though.
+ * Make all paths look like Unix
*/
void
canonicalize_path(char *path)
{
#ifdef WIN32
+ /*
+ * The Windows command processor will accept suitably quoted paths
+ * with forward slashes, but barfs badly with mixed forward and back
+ * slashes.
+ */
char *p;
for (p = path; *p; p++)
@@ -107,8 +106,19 @@ canonicalize_path(char *path)
if (*p == '\\')
*p = '/';
}
+ /* In Win32, if you do:
+ * prog.exe "a b" "\c\d\"
+ * the system will pass \c\d" as argv[2].
+ */
+ if (p > path && *(p-1) == '"')
+ *(p-1) = '/';
#endif
+ /*
+ * Removing the trailing slash on a path means we never get
+ * ugly double slashes. Don't remove a leading slash, though.
+ * Also, Win32 can't stat() a directory with a trailing slash.
+ */
trim_trailing_separator(path);
}