I've commited this since it is in code only used by mswindows variants.
andy
At 01:19 AM 3/20/01 +0100, Dan Holmsand wrote:
I've actually found a fix, after a few failed attempts (see
earlier
message...).
I also include a small fix for native windows (drive letters aren't
lowercased by file-truename for nonexisting files).
Here goes: try it out!
/dan
2001-03-20 Dan Holmsand <dan(a)eyebee.com>
* realpath.c (xrealpath): Make file-truename work with symlinks to
/cygdrive paths on cygwin. Always lowercase drive-letters on
native windows.
(cygwin_readlink): Don't try to find canonical filename unless
file exists.
Index: src/realpath.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/realpath.c,v
retrieving revision 1.6.2.9
diff -u -r1.6.2.9 realpath.c
--- src/realpath.c 2000/12/05 02:45:14 1.6.2.9
+++ src/realpath.c 2001/03/20 00:04:59
@@ -137,7 +137,7 @@
cygwin_readlink (const char * name, char * buf, int size)
{
int n = readlink (name, buf, size);
- if (n < 0)
+ if (n < 0 && errno == EINVAL)
{
/* The file may exist, but isn't a symlink. Try to find the
right name. */
@@ -208,6 +208,9 @@
if (abslen == 2 || abslen == 3)
{
strncpy (new_path, path, abslen);
+ /* Make sure drive letter is lowercased. */
+ if (abslen == 3)
+ *new_path = tolower (*new_path);
new_path += abslen;
path += abslen;
}
@@ -299,7 +302,11 @@
if (n < 0)
{
/* EINVAL means the file exists but isn't a symlink. */
- if (errno != EINVAL)
+#ifdef CYGWIN
+ if (errno != EINVAL && errno != ENOENT)
+#else
+ if (errno != EINVAL)
+#endif
return NULL;
}
else
@@ -345,10 +352,5 @@
/* Make sure it's null terminated. */
*new_path = '\0';
-#ifdef WIN32_NATIVE
- if (ABS_LENGTH (resolved_path) == 3)
- /* Lowercase drive letter. */
- *resolved_path = tolower (*resolved_path);
-#endif
return resolved_path;
}
Andy Piper <andyp(a)bea.com> writes:
> Dan,
>
> I think this was your fix. Any chance you can re-fix?
>
> Thanks
>
> andy
>
--
Dan Ola Holmsand
IB
dan(a)eyebee.com