From fbfae3483795160255dce4317b7dd1f112b631db Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 15 Aug 2011 00:10:06 +0000 Subject: [PATCH] #4422 On Mac, tr_getWebClientDir() uses incorrect encoding for creating the web content dir path --- libtransmission/platform.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libtransmission/platform.c b/libtransmission/platform.c index 10048c5b9..093309b8a 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.c @@ -571,14 +571,10 @@ tr_getWebClientDir( const tr_session * session UNUSED ) CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) ); CFStringRef appRef = CFURLCopyFileSystemPath( appURL, kCFURLPOSIXPathStyle ); - CFIndex appLength = CFStringGetMaximumSizeForEncoding( CFStringGetLength(appRef), - CFStringGetFastestEncoding( appRef )); + const CFIndex appStringLength = CFStringGetMaximumSizeOfFileSystemRepresentation(appRef); - char * appString = tr_malloc( appLength + 1 ); - bool success = CFStringGetCString( appRef, - appString, - appLength + 1, - CFStringGetFastestEncoding( appRef )); + char * appString = tr_malloc( appStringLength ); + const bool success = CFStringGetFileSystemRepresentation( appRef, appString, appStringLength ); assert( success ); CFRelease( appURL );