问题描述
我已经使用了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)
,那么你可以很容易地使用 的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:如何确定文件系统是区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!