Skip navigation.
 
mlRe: Changing file & directory names
FROM : Andy Lee
DATE : Wed Jul 05 03:11:44 2006

On Jul 4, 2006, at 12:07 PM, Sean McBride wrote:
> Yes, yes, movePath:toPath:handler: can be used, but if you look
> at its docs (which we've been over carefully now) you'll see the word
> 'rename' appears nowhere.  And if one is not familiar with the 
> (bizarre)
> unix concept of 'moving' a file to rename it, then it's not at all 
> clear
> that this API can be used.  And if you search the Cocoa docs and even
> the Cocoa headers for 'rename' you come up pretty dry.  This is quite
> discouraging.


I usually sing the praises of Cocoa's consistent and intuitive 
naming, but I agree here.  It should be trivial to find out how to 
rename a file by searching for "rename file".  If you do this search 
in Xcode's Documentation window, you get nothing about the movePath 
method.

movePath only does what we normally think of as renaming a file in 
one special case: when the original path matches the new path, except 
for the last component.  However, because this special case is a 
frequently desired one, I think the docs should mention it and use 
the word "rename" somewhere so it turns up in an Xcode search.

I think there should be a convenience method that can more naturally 
be described as renaming a file.  Maybe something like -[FileManager 
renameFileAtPath:to:], where the second argument is not allowed to be 
a path.  Of course, one can easily add this method in a category.

--Andy

Related mailsAuthorDate
mlChanging file & directory names Dean Snyder Jul 1, 19:23
mlRe: Changing file & directory names Greg Titus Jul 1, 19:26
mlRe: Changing file & directory names Dean Snyder Jul 1, 19:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 20:15
mlRe: Changing file & directory names John Stiles Jul 1, 21:18
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:28
mlRe: Changing file & directory names John Stiles Jul 1, 21:40
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:47
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:57
mlRe: Changing file & directory names John Stiles Jul 1, 22:13
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:10
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:19
mlRe: Changing file & directory names Rosyna Jul 2, 02:26
mlRe: Changing file & directory names Derrick Bass Jul 2, 02:28
mlRe: Changing file & directory names Sherm Pendley Jul 2, 03:21
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:39
mlRe: Changing file & directory names Chris Suter Jul 2, 03:47
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:54
mlRe: Changing file & directory names Adam R. Maxwell Jul 2, 09:16
mlRe: Changing file & directory names Matt Neuburg Jul 2, 09:27
mlRe: Changing file & directory names Frode Jul 2, 11:17
mlRe: Changing file & directory names John Stiles Jul 2, 18:20
mlRe: Changing file & directory names Sean McBride Jul 4, 18:07
mlRe: Changing file & directory names Adam R. Maxwell Jul 4, 18:41
mlRe: Changing file & directory names Andy Lee Jul 5, 03:11