• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File Path String From Save Panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Path String From Save Panel


  • Subject: Re: File Path String From Save Panel
  • From: Peter Hudson <email@hidden>
  • Date: Mon, 04 Mar 2013 21:07:41 +0000

Thanks Iain and Lee Ann

path was the method I needed.

Peter


On 4 Mar 2013, at 20:38, Lee Ann Rucker <email@hidden> 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   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 (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

References: 
 >File Path String From Save Panel (From: Peter Hudson <email@hidden>)
 >Re: File Path String From Save Panel (From: Lee Ann Rucker <email@hidden>)

  • Prev by Date: Re: Finding out what's incorrectly calling an Obj-C method
  • Next by Date: Re: Finding out what's incorrectly calling an Obj-C method
  • Previous by thread: Re: File Path String From Save Panel
  • Next by thread: Re: File Path String From Save Panel
  • Index(es):
    • Date
    • Thread