From eac4134968bf69d716e5f2045d88b3742a3c1e76 Mon Sep 17 00:00:00 2001 From: Andy Matuschak Date: Fri, 20 Jun 2008 23:29:35 -0700 Subject: [PATCH] Replaced UTF8String with fileSystemRepresentation and [NSString initWithUTF8String] with [NSFileManager stringWithFileSystemRepresentation:length:] as appropriate. --- NSWorkspace_RBAdditions.m | 7 ++----- SUPipedUnarchiver.m | 2 +- SUUnarchiver_Private.m | 2 +- relaunch.m | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/NSWorkspace_RBAdditions.m b/NSWorkspace_RBAdditions.m index 15f69ccc..1ffac239 100644 --- a/NSWorkspace_RBAdditions.m +++ b/NSWorkspace_RBAdditions.m @@ -137,11 +137,8 @@ static NSString* CheckParents(io_object_t thing,NSString* part,NSMutableDictiona NSMutableDictionary* result = nil; struct statfs fs = {}; if (!statfs(ccpath,&fs)) { - NSString* from = [NSString stringWithUTF8String:fs.f_mntfromname]; - result = [NSMutableDictionary dictionaryWithObjectsAndKeys: - [NSString stringWithUTF8String:fs.f_fstypename],NSWorkspace_RBfstypename, - [NSString stringWithUTF8String:fs.f_mntonname],NSWorkspace_RBmntonname, - nil]; + NSString* from = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:fs.f_mntfromname length:strlen(fs.f_mntfromname)]; + result = [NSMutableDictionary dictionaryWithObjectsAndKeys:[NSString stringWithUTF8String:fs.f_fstypename], NSWorkspace_RBfstypename, [[NSFileManager defaultManager] stringWithFileSystemRepresentation:fs.f_mntonname length:strlen(fs.f_mntonname)], NSWorkspace_RBmntonname, nil]; const char* devstring = "/dev/"; size_t devstringlen = 5; if (strncmp(fs.f_mntfromname,devstring,devstringlen)==0) { diff --git a/SUPipedUnarchiver.m b/SUPipedUnarchiver.m index a57a3aa5..9ad911c8 100644 --- a/SUPipedUnarchiver.m +++ b/SUPipedUnarchiver.m @@ -53,7 +53,7 @@ fp = fopen([archivePath fileSystemRepresentation], "r"); if (!fp) goto reportError; - setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] UTF8String], 1); + setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1); cmdFP = popen([command fileSystemRepresentation], "w"); if (!cmdFP) goto reportError; diff --git a/SUUnarchiver_Private.m b/SUUnarchiver_Private.m index dff767da..a705a0ac 100644 --- a/SUUnarchiver_Private.m +++ b/SUUnarchiver_Private.m @@ -66,7 +66,7 @@ static NSMutableArray *__unarchiverImplementations; - (NSString *)__UTI { FSRef fsRefToItem; - FSPathMakeRef((UInt8 *)[[self path] UTF8String], &fsRefToItem, NULL ); + FSPathMakeRef((UInt8 *)[[self path] fileSystemRepresentation], &fsRefToItem, NULL ); NSString *UTI = nil; LSCopyItemAttribute(&fsRefToItem, kLSRolesAll, kLSItemContentType, (CFTypeRef *)(&UTI)); diff --git a/relaunch.m b/relaunch.m index 46d52496..b98cf666 100644 --- a/relaunch.m +++ b/relaunch.m @@ -36,7 +36,7 @@ - (void) relaunch { - [[NSWorkspace sharedWorkspace] openFile:[NSString stringWithUTF8String:executablePath]]; + [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]]; [[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil]; exit(0); }