#include <CoreServices/CoreServices.h>
#include <CoreFoundation/CFString.h>
BOOL IsFileSystemCaseSensitive(const char* path)
{
FSRef ref;
FSCatalogInfo info;
GetVolParmsInfoBuffer buffer;
if ((FSPathMakeRef((const UInt8*)path, &ref, NULL) == noErr) &&
(FSGetCatalogInfo(&ref, kFSCatInfoVolume, &info, NULL, NULL, NULL) == noErr) &&
(FSGetVolumeParms(info.volume, &buffer, sizeof(buffer)) == noErr) &&
(buffer.vMVersion > 2))
{
if ((buffer.vMExtendedAttributes & (1 << bIsCaseSensitive)) != 0)
return TRUE;
}
return FALSE:
}
If the path parameter is simply an ANSI string then this function works fine. However, if it is a unicode string, then you'll need to call CFStringGetFileSystemRepresentation to get everything encoded correctly.
No comments:
Post a Comment