Re: [PATCH 10/40] Windows: Treat Windows style path names.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, 27 Feb 2008, Johannes Sixt wrote:

> diff --git a/cache.h b/cache.h
> index e1000bc..3e4e10a 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -441,7 +441,11 @@ int safe_create_leading_directories(char *path);
>  char *enter_repo(char *path, int strict);
>  static inline int is_absolute_path(const char *path)
>  {
> +#ifndef __MINGW32__
>  	return path[0] == '/';
> +#else
> +	return path[0] == '/' || (path[0] && path[1] == ':');

Maybe "(isalpha(path[0]) && ...)"?

And maybe make this an inline function in git-compat-util.h, like this?

static inline int has_dos_drive_prefix(const char *path)
{
#ifdef __MINGW32__
	return isalpha(*path) && path[1] == ':';
#else
	return 0;
#endif
}

> diff --git a/setup.c b/setup.c
> index dc247a8..77cc461 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -4,13 +4,26 @@
>  static int inside_git_dir = -1;
>  static int inside_work_tree = -1;
>  
> +#ifdef __MINGW32__
> +static inline int is_dir_sep(char c) { return c == '/' || c == '\\'; }
> +#else
> +static inline int is_dir_sep(char c) { return c == '/'; }
> +#endif

I think if you rename it to is_dir_separator(), you can put it into 
git-compat-util.h, right after the PATH_SEPARATOR Paolo suggested.

Thanks,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux