site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 9, 2007, at 11:51 PM, Nathaniel Gray wrote: On Apr 9, 2007, at 4:57 PM, Nathaniel Gray wrote: struct attrlist alist; bzero(&alist, sizeof(alist)); alist.volattr = ATTR_VOL_CAPABILITIES; unsigned char buffer[sizeof(vol_capabilities_attr_t) + sizeof(size_t)]; ... // See man page for how to setup and interpret buffer err = getattrlist(path, &alist, buffer, sizeof(buffer), 0); if (!err && (alist.volattr & ATTR_VOL_CAPABILITIES) { vol_capabilities_attr_t *vcaps; // cast buffer to caps if (vcaps->capabilities[0] & VOL_CAP_FMT_CASE_SENSITIVE) { ; // vol is case sensitive } else { ; // vol is case insensitive } } Brian Bergstrand <http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFGG7idedHYW7bHtqIRAr3xAKDTIok3XB/ihtUeOC+TZaEeaijAlgCgrcFc /60OlgVEUV1NLlssPnL3+/0= =TMR7 -----END PGP SIGNATURE----- _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Apr 9, 2007, at 6:04 PM, Don Brady wrote: Is there any non-hackish way to detect the case-sensitivity of a filesystem, like a system call? statvfs doesn't appear to do it and statfs doesn't help either (case-sensitive and case- insensitive hfs+ have the same f_type and f_fstypename). Or is there no avoiding the "create foo, open Foo" hack? You can use pathconf(2) with the _PC_CASE_SENSITIVE selector. Note an EINVAL result for this selector generally implies case- sensitive. This works nicely for hfs+ in the case-sensitive and insensitive variants. Unfortunately it looks like EINVAL is returned by smbfs and fat32, which are both case-insensitive, and ufs, which is case- sensitive. So I guess this test is only reliable when EINVAL is not returned (probably just for hfs-family filesystems). Any other suggestions? You can get this info via the getattrlist() syscall (std disclaimer concerning code written in Mail applies): This email sent to site_archiver@lists.apple.com