- Subject: RE: Problems with filenames on windows
- From: SANGOI DINO LEONARDO <SANGOID@xxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jan 2006 12:00:34 +0100
> -----Original Message-----
> From: Marko Mahnic
> Sent: lunedì 23 gennaio 2006 9.18
> Subject: Re: Problems with filenames on windows
>
> Thanks, noe it works.
> There is still a problem with network names.
>
> If I open '\\server\shareddir\file.txt' jed/wjed opens the file, but
> displays 'Directory \\server\shareddir\ is invalid'.
>
> The file can be saved normally (^X^S).
Yes, and as far as I can remember, wjed behaves this way from a long time...
Today I debugged it, and now I know what it happens...
Please notice that this happens only when opening a file directly on the
share, but doesn't if the file is in a subdirectory, so opening
\\server\\share\dir\file.txt will not generate an error.
The problem is that the _stat() system function fails on share names, and
'find_file_hook()' in site.sl does a 'if (file_status(dir) != 2)
verror(...);'. file_status() uses _stat(), and fails on the share name.
This is another windows stupidity if you ask me...
Anyways, to fix it we should use a hack: maybe we can use some other system
call...
Ok, there is a lighty tested patch: anyways it should do little harm, as I
change only what happens if stat() fails(). with this patch applied, I get:
file_status("\\\\server\\existing_share") == 2.
file_status("\\\\server\\not_existing_share") == 0.
--------
Index: win32.c
===================================================================
--- win32.c (revision 130)
+++ win32.c (working copy)
@@ -269,8 +269,22 @@
stat(ourname, &buf) < 0
#endif
)
- return 0;
-
+ {
+ if (ourname[0] == SLASH_CHAR && ourname[1] == SLASH_CHAR)
+ {
+ int at = GetFileAttributes(ourname);
+
+ if (at >= 0)
+ {
+ if (at & FILE_ATTRIBUTE_DIRECTORY)
+ return 2;
+ else
+ return 1;
+ }
+ }
+ return 0;
+ }
+
*mode = buf.st_mode & 0777;
if (buf.st_mode & S_IFDIR) return (2);
--------
Hope this helps,
Dino
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]