emacs-devel
[Top][All Lists]
Advanced

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

NTEmacs fails copy-file


From: Tak Ota
Subject: NTEmacs fails copy-file
Date: Thu, 07 Mar 2002 23:18:26 -0800 (PST)

On NTEmacs 21.2.50, when `copy-file' function take a FILE that has a
read only file attribute, the function fails with an error.  Following
patch corrects this problem.  The same bug exists in 21.1.90 also.

-Tak

*** fileio.c.orig       Mon Mar  4 07:00:02 2002
--- fileio.c    Thu Mar  7 23:04:07 2002
***************
*** 2408,2420 ****
      report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
    else if (NILP (keep_time))
      {
        EMACS_TIME now;
        EMACS_GET_TIME (now);
        if (set_file_times (XSTRING (encoded_newname)->data,
                          now, now))
!       Fsignal (Qfile_date_error,
!                Fcons (build_string ("Cannot set file date"),
!                       Fcons (newname, Qnil)));
      }
  #else /* not WINDOWSNT */
    ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0);
--- 2408,2426 ----
      report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
    else if (NILP (keep_time))
      {
+       DWORD attributes = GetFileAttributes(XSTRING (encoded_newname)->data);
        EMACS_TIME now;
        EMACS_GET_TIME (now);
+       SetFileAttributes(XSTRING (encoded_newname)->data, attributes & 
~FILE_ATTRIBUTE_READONLY);
        if (set_file_times (XSTRING (encoded_newname)->data,
                          now, now))
!       {
!         SetFileAttributes(XSTRING (encoded_newname)->data, attributes);
!         Fsignal (Qfile_date_error,
!                  Fcons (build_string ("Cannot set file date"),
!                         Fcons (newname, Qnil)));
!       }
!       SetFileAttributes(XSTRING (encoded_newname)->data, attributes);
      }
  #else /* not WINDOWSNT */
    ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]