Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
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