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






Cocoa mail archive

