all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* renaming directories on windows port
@ 2006-06-21 14:08 martin rudalics
  2006-06-21 18:54 ` Mathias Dahl
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: martin rudalics @ 2006-06-21 14:08 UTC (permalink / raw)


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  <rudalics@gmx.at>

	* 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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-02 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-21 14:08 renaming directories on windows port martin rudalics
2006-06-21 18:54 ` Mathias Dahl
2006-06-21 22:36 ` David Glasser
2006-07-02 15:50   ` Stefan Monnier
2006-06-23 10:21 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.