• 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: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...


  • Subject: Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
  • From: Chase <email@hidden>
  • Date: Mon, 18 Jul 2005 18:06:27 -0500

Can you explain why you would want to rely on this?


the problem is that i'm looking for a path in the com.apple.dock prefs domain and i need to compare it to my bundle path to see if my app is already in the dock. the paths in the dock seem to all have trailing slashes, but i don't want to depend on that, since any user could certainly pop open the plist file and add a pathname that doesn't have a trailing slash.

i know it's an obscure thing to worry about, but still... it'll bug me if i don't.

anyway, i resolved the issue by checking the bundle path for a trailing slash, if its there, i create an identical sencond string without the slash. if it's not there, i create an identical second string with a trailing slash.

so:

bpath_1 ->  @"/Applications/AppName.app"
bpath_2 ->  @"/Applications/AppName.app/"

(or vice versa)


then i compare both against the path in the dock prefs.

it's a little extra cludge, but it'll make me feel a little more at ease.

there should be a stringWithNoTrailingPathSeparator method in NSString. that would be a quick and simple way to normalize two paths for string comparison.

in any case, thanks.

- chase



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
      • From: Douglas Davidson <email@hidden>
References: 
 >[[NSBundle mainBundle] bundlePath] and trailng slashes... (From: Chase <email@hidden>)
 >Re: [[NSBundle mainBundle] bundlePath] and trailng slashes... (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: CoreData: Editing a model with XCode corrupts reflefive relationships [SOLVED]
  • Next by Date: Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
  • Previous by thread: Re: [[NSBundle mainBundle] bundlePath] and trailng slashes...
  • Next by thread: Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
  • Index(es):
    • Date
    • Thread