Benson Margulies wrote:
Can you point me at some description of how to get off the ground as
an
XEmacs contributor.
... Please do it this way:
#define DONT_CHECK_DIRECTORY_WRITABLE
#if !defined(MS_WINDOWS) || !defined(DONT_CHECK_DIRECTORY_WRITABLE)
/* code that does the wrong thing on windows */
#endif
and send a patch to xemacs-patches.
Benson, feel free to take this on--I don't
have the time or the
expertise. Here's what I did on my system using the XEmacs 21.4.19 source:
In src/fileio.c:
DEFUN ("file-writable-p", Ffile_writable_p, 1, 1, 0, /*
Return t if file FILENAME can be written or created by you.
*/
(filename))
{
/* This function can GC. GC checked 1997.04.10. */
Lisp_Object abspath, dir;
Lisp_Object handler;
struct stat statbuf;
struct gcpro gcpro1;
CHECK_STRING (filename);
abspath = Fexpand_file_name (filename, Qnil);
/* If the file name has special constructs in it,
call the corresponding file handler. */
GCPRO1 (abspath);
handler = Ffind_file_name_handler (abspath, Qfile_writable_p);
UNGCPRO;
if (!NILP (handler))
return call2 (handler, Qfile_writable_p, abspath);
if (xemacs_stat ((char *) XSTRING_DATA (abspath), &statbuf) >= 0)
return (check_writable ((char *) XSTRING_DATA (abspath))
? Qt : Qnil);
// GCPRO1 (abspath);
// dir = Ffile_name_directory (abspath);
// UNGCPRO;
// return (check_writable (!NILP (dir) ? (char *) XSTRING_DATA (dir)
//: "")
// ? Qt : Qnil);
//AF The check_writable() method doesn't work correctly on NTFS so
//we are going to lie
return Qt;
}
With Stephen's suggestion, the commented out section would become:
#if !defined(MS_WINDOWS) || !defined(DONT_CHECK_DIRECTORY_WRITABLE)
GCPRO1 (abspath);
dir = Ffile_name_directory (abspath);
UNGCPRO;
return (check_writable (!NILP (dir) ? (char *) XSTRING_DATA (dir)
: "")
? Qt : Qnil);
#else
return Qt;
#endif
The "right" solution would be to fix the check_writable function in the
same file:
static int
check_writable (const char *filename)
{
#ifdef MS_WINDOWS
// Use correct access control for Windows
// Needs to work for FAT, FAT32, NTFS and ???
// Filename can be a file, directory, junction point(?), shortcut(??)
#else
#ifdef HAVE_EACCESS
return (eaccess (filename, W_OK) >= 0);
#else
/* Access isn't quite right because it uses the real uid
and we really want to test with the effective uid.
But Unix doesn't give us a right way to do it.
Opening with O_WRONLY could work for an ordinary file,
but would lose for directories. */
return (access (filename, W_OK) >= 0);
#endif
#endif
}
If you don't plan to take this on, let me know and I'll try to submit a
patch for the stop-gap solution.
--
Tony Freixas
Tiger Heron LLC
tony(a)tigerheron.com
http://www.tigerheron.com
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta