Thanks Iain and Lee Ann

path was the method I needed.

Peter


On 4 Mar 2013, at 20:38, Lee Ann Rucker <lruc...@vmware.com> wrote:

> 
> On Mar 4, 2013, at 8:25 AM, Peter Hudson wrote:
> 
>> I recover the path string from a Save Panel like so :-
>> 
>> NSArray *pathComponents = [[sp  URL]  pathComponents];
>> 
>> When I put them together again to use to write a file, any spaces in the 
>> file name are turned in %20 symbols.
>> 
>> Any suggestions what I am doing wrong ?
> 
> My first smart-alec reaction is to say "taking it apart and putting it back 
> together", but seriously, that isn't a good idea. URLs aren't Unix file 
> paths.  If you've got a valid NSURL, why not keep it around and use it later? 
> Which raises the question - how are you using it to write a file? If it's 
> NSFileManager methods, the original NSURL is all you need; if lower-level or 
> methods that only have NSString versions, use [NSURL path].
> 
> If you do need to split the path up, it would help to know why. 
> lastPathComponent, pathExtension, and URLBy[Appending/Deleting]PathComponent 
> should cover most of what you need to do with file paths. The last time I 
> cared about pathComponents wasn't for file IO, it was for a "Recent Items" 
> -style name disambiguator - you know, how it'll show just the 
> lastPathComponent until there are two that match, and then it finds the first 
> non-matching component.
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to