Compare commits
1 Commits
master
...
fix-macos-
Author | SHA1 | Date |
---|---|---|
Koen Schmeets | 4e823477a6 |
|
@ -321,15 +321,16 @@ static std::string FilesystemNormalize(const std::string &str) {
|
||||||
std::transform(strW.begin(), strW.end(), strW.begin(), towlower);
|
std::transform(strW.begin(), strW.end(), strW.begin(), towlower);
|
||||||
return Narrow(strW);
|
return Narrow(strW);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
CFMutableStringRef cfStr =
|
CFStringRef cfStr = CFStringCreateWithBytesNoCopy(NULL, (const UInt8*)str.data(), str.size(),
|
||||||
CFStringCreateMutableCopy(NULL, 0,
|
kCFStringEncodingUTF8, /*isExternalRepresentation=*/false, kCFAllocatorNull);
|
||||||
CFStringCreateWithBytesNoCopy(NULL, (const UInt8*)str.data(), str.size(),
|
CFMutableStringRef cfmStr = CFStringCreateMutableCopy(NULL, 0, cfStr);
|
||||||
kCFStringEncodingUTF8, /*isExternalRepresentation=*/false, kCFAllocatorNull));
|
CFStringLowercase(cfmStr, NULL);
|
||||||
CFStringLowercase(cfStr, NULL);
|
|
||||||
std::string normalizedStr;
|
std::string normalizedStr;
|
||||||
normalizedStr.resize(CFStringGetMaximumSizeOfFileSystemRepresentation(cfStr));
|
normalizedStr.resize(CFStringGetMaximumSizeOfFileSystemRepresentation(cfmStr));
|
||||||
CFStringGetFileSystemRepresentation(cfStr, &normalizedStr[0], normalizedStr.size());
|
CFStringGetFileSystemRepresentation(cfmStr, &normalizedStr[0], normalizedStr.size());
|
||||||
normalizedStr.erase(normalizedStr.find('\0'));
|
normalizedStr.erase(normalizedStr.find('\0'));
|
||||||
|
CFRelease(cfmStr);
|
||||||
|
CFRelease(cfStr);
|
||||||
return normalizedStr;
|
return normalizedStr;
|
||||||
#else
|
#else
|
||||||
return str;
|
return str;
|
||||||
|
|
Loading…
Reference in New Issue