FROM : Adam R. Maxwell
DATE : Tue Jul 04 18:41:04 2006
On Jul 4, 2006, at 09:07, Sean McBride wrote:
> On 2006-07-01 21:21, Sherm Pendley said:
>
>> That was essentially my assumption, yes - I'd assumed that the docs
>> were in some way correct, but written very badly, in a way that's
>> easy to misinterpret. It hadn't occurred to me that they might be
>> flat-out wrong - and I apologize to John Stiles for doubting him when
>> he pointed out that they are.
>
> I think with all this discussion of hardlinks and link and unlink, we
> have overlooked the simple fact that Cocoa lacks an API to rename
> files! 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.
>
> The CoreServices File Manager, on the other hand, has a very
> straightforward API: FSRenameUnicode().
To those of us who are familiar with the Unix concept of move as
rename, the Carbon File Manager is incredibly bizarre: it seems like
you usually have five different ways to do the same thing, of which
at least two are deprecated (and good luck with the single page of
documentation that makes Xcode's doc browser puke).
Don't get me wrong; I use FSRefs when appropriate, and wrote Cocoa
wrapper methods for some of the Carbon File Manager since it's
generally thread safe and NSFileManager isn't. In general, though, I
find it far less straightforward than NSFileManager.
-- Adam
DATE : Tue Jul 04 18:41:04 2006
On Jul 4, 2006, at 09:07, Sean McBride wrote:
> On 2006-07-01 21:21, Sherm Pendley said:
>
>> That was essentially my assumption, yes - I'd assumed that the docs
>> were in some way correct, but written very badly, in a way that's
>> easy to misinterpret. It hadn't occurred to me that they might be
>> flat-out wrong - and I apologize to John Stiles for doubting him when
>> he pointed out that they are.
>
> I think with all this discussion of hardlinks and link and unlink, we
> have overlooked the simple fact that Cocoa lacks an API to rename
> files! 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.
>
> The CoreServices File Manager, on the other hand, has a very
> straightforward API: FSRenameUnicode().
To those of us who are familiar with the Unix concept of move as
rename, the Carbon File Manager is incredibly bizarre: it seems like
you usually have five different ways to do the same thing, of which
at least two are deprecated (and good luck with the single page of
documentation that makes Xcode's doc browser puke).
Don't get me wrong; I use FSRefs when appropriate, and wrote Cocoa
wrapper methods for some of the Carbon File Manager since it's
generally thread safe and NSFileManager isn't. In general, though, I
find it far less straightforward than NSFileManager.
-- Adam






Cocoa mail archive

