What is the modern way to rename a volume on Mac OS X?
I'm trying to write some code to change the volume name on Mac OS X. Unfortunately, the documentation in this area is less than helpful.
What I have found so far:
FSGetVolumeInfo
can be used to get the volume name, but the correspondingFSSetVolumeInfo
lacks the parameters to set it.PBGetVolumeInfoSync
can be used to get the volume name, but reading the docs 开发者_开发百科for the correspondingPBSetVolumeInfoSync
, it does not appear to be possible to set it. In practice when I try to do so, I get error code -35.PBHRenameSync
can be used to "rename a file, directory, or volume." However, it is marked as deprecated and "replaced byPBRenameUnicodeSync
." Naturally,PBRenameUnicodeSync
is documented as "renames a file or folder", which hardly makes it a viable replacement.
So what is the right way to do this?
I would expect that the name of the volume would be the same as the name of the root directory of that volume, so that something like FSRenameUnicode
should work.
精彩评论