OS X: Use fileSystemRepresentation when using low-level file paths:

This should cause less breakage on APFS.
This commit is contained in:
C.W. Betts
2017-06-30 09:37:31 -06:00
committed by Celtic Minstrel
parent 1b210d4358
commit 3c57e51d47

View File

@@ -46,9 +46,8 @@ static NSImage* imageFromURL(CFURLRef url){
}
Cursor::Cursor(fs::path path, float hotSpotX, float hotSpotY){
FSRef ref;
FSPathMakeRef((UInt8*)path.c_str(), &ref, nullptr);
CFURLRef imgPath = CFURLCreateFromFSRef(nullptr, &ref);
NSString *ref = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path.c_str() length:strlen(path.c_str())];
CFURLRef imgPath = (CFURLRef)[NSURL fileURLWithPath:ref];
NSImage *img = imageFromURL(imgPath);
NSCursor *cursor = [[NSCursor alloc] initWithImage:img hotSpot:NSMakePoint(hotSpotX, hotSpotY)];