且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MAC OS X:如何确定文件系统是否区分大小写?

更新时间:2022-05-11 16:59:25

如果您已经在使用 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.