Windows: Treat Windows style path names.

GIT's guts work with a forward slash as a path separators. We do not change
that. Rather we make sure that only "normalized" paths enter the depths
of the machinery.

We have to translate backslashes to forward slashes in the prefix and in
command line arguments. Fortunately, all of them are passed through
functions in setup.c.

A macro has_dos_drive_path() is defined that checks whether a path begins
with a drive letter+colon combination. This predicate is always false on
Unix. Another macro is_dir_sep() abstracts that a backslash is also a
directory separator on Windows.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
Johannes Sixt
2008-03-05 21:51:27 +01:00
parent 4cd148d83f
commit 25fe217b86
5 changed files with 67 additions and 15 deletions

View File

@ -40,6 +40,19 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
return result;
}
#undef getcwd
char *mingw_getcwd(char *pointer, int len)
{
int i;
char *ret = getcwd(pointer, len);
if (!ret)
return ret;
for (i = 0; pointer[i]; i++)
if (pointer[i] == '\\')
pointer[i] = '/';
return ret;
}
struct passwd *getpwuid(int uid)
{
static struct passwd p;