Get case sensitivity of mounted share?

Is there a way to get the case sensitivity setting (true or false) of a mounted share? Ideally it could be of any type - AFP, SMB, WebDAV, etc.

I was hoping it would just be in “properties” of the alias of the drive in Applescript, but it’s not.

Googling this, I found the shell command “getattrlist” which looks promising - it has the property “VOL_CAP_FMT_CASE_SENSITIVE.” When I found that, I thought I was done. But I just bumble my way through the shell, and the usage examples included in the man page are alien to me… I’m used to shell commands that are one line with a couple arguments and a few flags… this looks like an Objective C program? Any help from the ASObjC people, or any other way to find this info?

EXAMPLES
     The following code prints the file type and creator of a file, assuming that the volume
     supports the required attributes.

     #include <assert.h>
     #include <stdio.h>
     #include <string.h>
     #include <sys/attr.h>
     #include <sys/errno.h>
     #include <unistd.h>
     #include <sys/vnode.h>

     typedef struct attrlist attrlist_t;

     struct FInfoAttrBuf {
         u_int32_t       length;
         fsobj_type_t    objType;
         char            finderInfo[32];
     }  __attribute__((aligned(4), packed));
     typedef struct FInfoAttrBuf FInfoAttrBuf;

     static int FInfoDemo(const char *path)
     {
         int             err;
         attrlist_t      attrList;
         FInfoAttrBuf    attrBuf;

         memset(&attrList, 0, sizeof(attrList));
         attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
         attrList.commonattr  = ATTR_CMN_OBJTYPE | ATTR_CMN_FNDRINFO;

         err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0);
         if (err != 0) {
             err = errno;
         }

         if (err == 0) {
             assert(attrBuf.length == sizeof(attrBuf));

             printf("Finder information for %s:\n", path);
             switch (attrBuf.objType) {
                 case VREG:
                     printf("file type    = '%.4s'\n", &attrBuf.finderInfo[0]);
                     printf("file creator = '%.4s'\n", &attrBuf.finderInfo[4]);
                     break;
                 case VDIR:
                     printf("directory\n");
                     break;
                 default:
                     printf("other object type, %d\n", attrBuf.objType);
                     break;
             }
         }

         return err;
     }

This will do what you want:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set thePath to POSIX path of some item of (list disks) -- for testing
set theURL to current application's |NSURL|'s fileURLWithPath:thePath
set {theResult, theValue, theError} to theURL's getResourceValue:(reference) forKey:(current application's NSURLVolumeSupportsCaseSensitiveNamesKey) |error|:(reference)
if theResult is false then error theError's localizedDescription() as text
if theValue as boolean then
	display dialog thePath & " is case-sensitive"
else
	display dialog thePath & " is not case-sensitive"
end if

Thank you so much, Shane! Works Great.

In case anyone else finds this and just wants to get the answer for a specific disk, I made it so it asks instead of playing disk-roulette:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set thePath to POSIX path of alias (choose from list (list disks))
set theURL to current application's |NSURL|'s fileURLWithPath:thePath
set {theResult, theValue, theError} to theURL's getResourceValue:(reference) forKey:(current application's NSURLVolumeSupportsCaseSensitiveNamesKey) |error|:(reference)
if theResult is false then error theError's localizedDescription() as text
if theValue as boolean then
	display dialog thePath & " is case-sensitive"
else
	display dialog thePath & " is not case-sensitive"
end if