* path.h (path_conv): Make path_flags private. Rename known_suffix to

suffix and make private.  Rename normalized_path to posix_path and
	make privtae.  Accommodate name changes throughout in path_conv
	methods.
	(path_conv::known_suffix): New method.  Use throughout instead of
	accessing suffix directly.
	(path_conv::get_win32): Constify.
	(path_conv::get_posix): New method to read posix_path.  Use throughout
	instead of accessing normalized_path directly.
	(path_conv::set_posix): Rename from set_normalized_path.  Accommodate
	name change throughout.
	* spawn.cc (find_exec): Return POSIX path, not Win32 path.
This commit is contained in:
Corinna Vinschen
2015-02-15 08:59:55 +00:00
parent 6b14f3988c
commit d2bd82aa92
9 changed files with 80 additions and 78 deletions

View File

@@ -1,7 +1,7 @@
/* syscalls.cc: syscalls
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
This file is part of Cygwin.
@@ -2201,7 +2201,7 @@ rename (const char *oldpath, const char *newpath)
set_errno (ENOTDIR);
__leave;
}
if (oldpc.known_suffix
if (oldpc.known_suffix ()
&& (ascii_strcasematch (oldpath + olen - 4, ".lnk")
|| ascii_strcasematch (oldpath + olen - 4, ".exe")))
old_explicit_suffix = true;
@@ -2248,7 +2248,7 @@ rename (const char *oldpath, const char *newpath)
set_errno (newpc.isdir () ? EISDIR : ENOTDIR);
__leave;
}
if (newpc.known_suffix
if (newpc.known_suffix ()
&& (ascii_strcasematch (newpath + nlen - 4, ".lnk")
|| ascii_strcasematch (newpath + nlen - 4, ".exe")))
new_explicit_suffix = true;
@@ -2313,7 +2313,7 @@ rename (const char *oldpath, const char *newpath)
&ro_u_lnk, TRUE))
rename_append_suffix (newpc, newpath, nlen, ".lnk");
else if (oldpc.is_binary () && !old_explicit_suffix
&& oldpc.known_suffix
&& oldpc.known_suffix ()
&& !nt_path_has_executable_suffix
(newpc.get_nt_native_path ()))
/* Never append .exe suffix if oldpath had .exe suffix given
@@ -2353,7 +2353,7 @@ rename (const char *oldpath, const char *newpath)
explicitely, or if newfile is a binary (in which case the given
name probably makes sense as it is), or if the destination
filename has one of the blessed executable suffixes. */
if (!old_explicit_suffix && oldpc.known_suffix
if (!old_explicit_suffix && oldpc.known_suffix ()
&& !newpc.is_binary ()
&& !nt_path_has_executable_suffix
(newpc.get_nt_native_path ()))
@@ -3664,7 +3664,7 @@ chroot (const char *newroot)
else
{
getwinenv("PATH="); /* Save the native PATH */
cygheap->root.set (path.normalized_path, path.get_win32 (),
cygheap->root.set (path.get_posix (), path.get_win32 (),
!!path.objcaseinsensitive ());
ret = 0;
}
@@ -4714,7 +4714,7 @@ linkat (int olddirfd, const char *oldpathname,
set_errno (old_name.error);
__leave;
}
strcpy (oldpath, old_name.normalized_path);
strcpy (oldpath, old_name.get_posix ());
}
return link (oldpath, newpath);
}