emacs-devel
[Top][All Lists]
Advanced

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

renaming directories on windows port


From: martin rudalics
Subject: renaming directories on windows port
Date: Wed, 21 Jun 2006 16:08:32 +0200

On Windows when I have a directory called "c:/temp/foo" and try to

(rename-file "c:/temp/foo" "c:/temp/FOO")

Emacs tells me

(file-error "Renaming" "no such file or directory" "c:/TEMP/foo" 
"c:/TEMP/FOO/foo")

When `file' names a directory, and `newname' and `file' differ in case
only, the intended action of `rename-file' on Windows reasonably is to
just change the case of the directory name.  The trivial patch below
should resolve this:

2006-06-21  Martin Rudalics  <address@hidden>

        * fileio.c (Frename_file): Don't try to move directory to itself
        on DOS_NT platforms.

*** fileio.c    Tue Jun  6 19:20:40 2006
--- fileio.c    Wed Jun 21 11:41:34 2006
***************
*** 2750,2756 ****
    CHECK_STRING (newname);
    file = Fexpand_file_name (file, Qnil);

!   if (!NILP (Ffile_directory_p (newname)))
      newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
    else
      newname = Fexpand_file_name (newname, Qnil);
--- 2750,2762 ----
    CHECK_STRING (newname);
    file = Fexpand_file_name (file, Qnil);

!   if ((!NILP (Ffile_directory_p (newname)))
! #ifdef DOS_NT
!       /* If the file names are identical but for the case,
!        don't attempt to move directory to itself. */
!       && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
! #endif
!       )
      newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
    else
      newname = Fexpand_file_name (newname, Qnil);




reply via email to

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