Re: Unicode filenames with Apple File System and UIManagedDocument
Re: Unicode filenames with Apple File System and UIManagedDocument
- Subject: Re: Unicode filenames with Apple File System and UIManagedDocument
- From: Jens Alfke <email@hidden>
- Date: Tue, 07 Mar 2017 10:00:52 -0800
> On Mar 7, 2017, at 8:13 AM, email@hidden wrote:
>
> NSFileManager *fm = [[NSFileManager alloc] init];
> const char *data = [name fileSystemRepresentation];
> NSString *filename = [fm stringWithFileSystemRepresentation:data length:strlen(data)];
This is a no-op, since you’re calling two methods that perform inverse operations — `filename` will end up being identical to `name`.
The only reason to use the fileSystemRepresentation methods is if you need to convert a filename/path to or from a C string, for example if you’re calling a lower-level API like fopen, or you received a filename from a C string (like a command line argument.)
> Before what I was doing is:
> NSURL *url = [[self courseDirectory] URLByAppendingPathComponent:name];
That should work fine. If it doesn’t, it’s Apple’s bug not yours.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden