From b1b931de4e634be515e528d1d07d59551a86eded Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 8 Nov 2013 14:03:57 +0100 Subject: [PATCH] fsevents: use native character encoding file paths Create file paths with CFStringCreateWithFileSystemRepresentation(), not CFStringCreateWithCString(). Reapplies 3780e12 ("fsevents: support japaneese characters in path") from the v0.10 branch. Was dropped in the last v0.10 -> master merge for failing to apply. --- src/unix/fsevents.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c index 63084251..b13e75c5 100644 --- a/src/unix/fsevents.c +++ b/src/unix/fsevents.c @@ -120,9 +120,9 @@ static CFRunLoopSourceRef (*pCFRunLoopSourceCreate)(CFAllocatorRef, static void (*pCFRunLoopSourceSignal)(CFRunLoopSourceRef); static void (*pCFRunLoopStop)(CFRunLoopRef); static void (*pCFRunLoopWakeUp)(CFRunLoopRef); -static CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, - const char*, - CFStringEncoding); +static CFStringRef (*pCFStringCreateWithFileSystemRepresentation)( + CFAllocatorRef, + const char*); static CFStringEncoding (*pCFStringGetSystemEncoding)(void); static CFStringRef (*pkCFRunLoopDefaultMode); static FSEventStreamRef (*pFSEventStreamCreate)(CFAllocatorRef, @@ -425,9 +425,8 @@ static void uv__fsevents_reschedule(uv_fs_event_t* handle) { curr = QUEUE_DATA(q, uv_fs_event_t, cf_member); assert(curr->realpath != NULL); - paths[i] = pCFStringCreateWithCString(NULL, - curr->realpath, - pCFStringGetSystemEncoding()); + paths[i] = + pCFStringCreateWithFileSystemRepresentation(NULL, curr->realpath); if (paths[i] == NULL) { uv_mutex_unlock(&state->fsevent_mutex); goto final; @@ -528,7 +527,7 @@ static int uv__fsevents_global_init(void) { V(core_foundation_handle, CFRunLoopSourceSignal); V(core_foundation_handle, CFRunLoopStop); V(core_foundation_handle, CFRunLoopWakeUp); - V(core_foundation_handle, CFStringCreateWithCString); + V(core_foundation_handle, CFStringCreateWithFileSystemRepresentation); V(core_foundation_handle, CFStringGetSystemEncoding); V(core_foundation_handle, kCFRunLoopDefaultMode); V(core_services_handle, FSEventStreamCreate);