3

我正在更新我在 Mac App Store 上编写并拥有的备份实用程序。

在 Macintosh Cocoa 应用程序中,我如何找到磁盘卷的格式化方式?我发现的唯一正式的事情是做一个 GetResourceValue: for 'NSURLVolumeLocalizedFormatDescriptionKey',但这取决于语言。

我的实用程序不支持格式化为 FAT32 的卷。我的实用程序需要对 XSan 驱动器进行特殊处理。

4

2 回答 2

6

statfs(2)会给你一个非本地化的名字:

struct statfs volinfo;
if(statfs("/path/to/your/volume", &volinfo) != 0)
{
  perror("statfs");
  return -1;
}

fprintf(stderr, "%s\n", volinfo.f_fstypename);

查看/System/Library/Filesystems将在 中返回的名称f_fstypename

于 2013-02-21T18:24:49.077 回答
0

这个问题已经回答了,但我会投入我的 2 美分......

/sbin/mount | grep acfs | awk '{print $3}'

这输出

/Volumes/XsanVolumeName1
/Volumes/XsanVolumeName2
于 2017-03-30T20:27:33.660 回答