• 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: C: treated as a path component
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C: treated as a path component


  • Subject: Re: C: treated as a path component
  • From: Michael Ash <email@hidden>
  • Date: Wed, 15 Apr 2009 11:54:43 -0400

2009/4/14 Dragan Milić <email@hidden>:
> Hell all,
>
> Let's suppose I've got NSString @"C:omponent" , which represents the name of
> a file. Is there a way to instruct NSString class not to treat a leading
> single letter followed by a column as a path separator? Namely, I need this
> one treated as only one path component @"C:omponent", but NSString sees two,
> @"C:" and "omponent". So, if I ask for the last path component, I get
> @"omponent" instead of the whole string @"C:omponent".
>
> I've searched documentation, took a look into NSPathUtilities.h, but no
> help.

As far as I can see, it only does this if that's at the beginning of
the string. If your string contains a full path, this doesn't happen.

One fix would be to make sure you only work with absolute paths. This
is generally a good idea anyway, since the working directory isn't
something you can count on being anything useful. Whether this is
practical depends on exactly what you're doing though.

Another fix would be to stick a / on the front before you make the
call to disable this behavior.

Or of course you could just parse the last path component yourself.

Mike
_______________________________________________

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: 
 >C: treated as a path component (From: Dragan Milić <email@hidden>)

  • Prev by Date: Re: C: treated as a path component
  • Next by Date: Re: filteredArrayUsingPredicate and points
  • Previous by thread: Re: C: treated as a path component
  • Next by thread: Re: C: treated as a path component
  • Index(es):
    • Date
    • Thread