开发者

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 corresponding FSSetVolumeInfo lacks the parameters to set it.
  • PBGetVolumeInfoSync can be used to get the volume name, but reading the docs 开发者_开发百科for the corresponding PBSetVolumeInfoSync, 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 by PBRenameUnicodeSync." 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜