MAC OS X:如何确定文件系统是区分大小写? [英] MAC OS X: How to determine if filesystem is case sensitive?

查看:973
本文介绍了MAC OS X:如何确定文件系统是区分大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了<一个href=\"http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/statfs.2.html%23//apple_ref/doc/man/2/statfs\">statfs(2)系统调用获得的Mac OS X文件系统的许多特性,但它并没有告诉我,如果文件系统是区分大小写。

I have used the statfs(2) system call to get many characteristics of a Mac OS X filesystem, but it doesn't tell me if the filesystem is case-sensitive or not.

我需要这些信息,因为我正在开发将围绕移动许多文件的应用程序,我要检测数据可能丢失,由于文件从一个病例的敏感文件系统到一个病例被移动敏感文件系统。

I need this information as the application I am developing will be moving many files around and I want to detect potential loss of data due to files being moved from a case-sensitive filesystem to a case-insensitive filesystem.

任何人都可以提出检测这样的方式?

Can anyone suggest a way of detecting this?

推荐答案

如果您已经使用 STAT(2),那么你可以很容易地使用<一个href=\"http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/pathconf.2.html\"相对=nofollow> 的pathconf(2) _PC_CASE_SENSITIVE 选择器(结果 0 =案例钝感, 1 =区分大小写。请注意,手册页是过时的,但 _PC_CASE_SENSITIVE _PC_CASE_ preSERVING 的支持。按照惯例,如果一个文件系统不支持 _PC_CASE_SENSITIVE 选择那么它是区分大小写的。

If you're already using stat(2), then you can easily use pathconf(2) with the _PC_CASE_SENSITIVE selector (result 0 = case-insensitve, 1 = case-sensitive. Note that the man page is out of date, but the _PC_CASE_SENSITIVE and _PC_CASE_PRESERVING are supported. By convention, if a file system doesn't support _PC_CASE_SENSITIVE selector then it is case-sensitive.

这篇关于MAC OS X:如何确定文件系统是区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆