Skip to content
Snippets Groups Projects
Commit a0fc05aa authored by Tom Lane's avatar Tom Lane
Browse files

Go back to emitting path names with forward slashes on Windows.

I'm not clear on what the double-backslash idea was intended to fix,
but it breaks at least mingw GNU Make.  Per report from Thomas Hallgren.
parent 84cc9a4b
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.15 2005/10/06 12:04:58 petere Exp $ * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.16 2005/10/13 17:58:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -32,9 +32,9 @@ static char mypath[MAXPGPATH]; ...@@ -32,9 +32,9 @@ static char mypath[MAXPGPATH];
/* /*
* This function cleans up the paths for use with either cmd.exe or Msys * This function cleans up the paths for use with either cmd.exe or Msys
* on Windows. We need them to use double backslashes and filenames without * on Windows. We need them to use filenames without spaces, for which a
* spaces (for which a short filename is the safest equivalent) eg: * short filename is the safest equivalent, eg:
* C:\\Progra~1\\ * C:/Progra~1/
* *
* This can fail in 2 ways - if the path doesn't exist, or short names are * This can fail in 2 ways - if the path doesn't exist, or short names are
* disabled. In the first case, don't return any path. In the second case, * disabled. In the first case, don't return any path. In the second case,
...@@ -45,8 +45,7 @@ static void ...@@ -45,8 +45,7 @@ static void
cleanup_path(char *path) cleanup_path(char *path)
{ {
#ifdef WIN32 #ifdef WIN32
int x=0, y=0; char *ptr;
char temp[MAXPGPATH];
if (GetShortPathName(path, path, MAXPGPATH - 1) == 0) if (GetShortPathName(path, path, MAXPGPATH - 1) == 0)
{ {
...@@ -60,30 +59,12 @@ cleanup_path(char *path) ...@@ -60,30 +59,12 @@ cleanup_path(char *path)
} }
} }
/* Replace '\' with '/' */
/* Replace '\' with '\\'. */ for (ptr = path; *ptr; ptr++)
for (x = 0; x < strlen(path); x++)
{
if (path[x] == '/' || path[x] == '\\')
{ {
temp[y] = '\\'; if (*ptr == '\\')
y++; *ptr = '/';
temp[y] = '\\';
} }
else
{
temp[y] = path[x];
}
y++;
/* Bail out if we're too close to MAXPGPATH */
if (y >= MAXPGPATH - 2)
break;
}
temp[y] = '\0';
strncpy(path, temp, MAXPGPATH - 1);
#endif #endif
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment