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

* Re: renaming directories on windows port
  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-06-23 10:21 ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Mathias Dahl @ 2006-06-21 18:54 UTC (permalink / raw)
  Cc: emacs-devel

> 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.

I agree.

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

* Re: renaming directories on windows port
  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
  2 siblings, 1 reply; 5+ messages in thread
From: David Glasser @ 2006-06-21 22:36 UTC (permalink / raw)


martin rudalics <rudalics <at> gmx.at> writes:

> 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:

Should this also be the semantics for other platforms with case-preserving
filesystems, such as the default MacOS X filesystem?

--dave

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

* Re: renaming directories on windows port
  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-06-23 10:21 ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2006-06-23 10:21 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Wed, 21 Jun 2006 16:08:32 +0200
> From: martin rudalics <rudalics@gmx.at>
> 
> 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.

Thanks, I installed this.

Please in the future include in the log entry the preprocessor
condition, if any, of the change.  Here's the ChangeLog entry I
committed:

	* fileio.c (Frename_file) [DOS_NT]: Don't try to move directory to
	itself on DOS_NT platforms, if the old and new names are identical
	but for the letter-case.

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

* Re: renaming directories on windows port
  2006-06-21 22:36 ` David Glasser
@ 2006-07-02 15:50   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2006-07-02 15:50 UTC (permalink / raw)
  Cc: emacs-devel

>> 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:

> Should this also be the semantics for other platforms with case-preserving
> filesystems, such as the default MacOS X filesystem?

I think so, yes.


        Stefan

^ 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.