Say I have an application called “My Path Tester.app”
I want to use the path of that application to find out where it is located - because I want to use that location for something else.
So I get the path to the application as a string, then replace the application name (“My Path Tester.app”) name with nothing (“”)…so the result should be the path to where the application is.
ie… if the path to my app is →
HD:Applications:myFolder:My Path Tester.app
and I replace the application name “My Path Tester.app” with nothing, my result is
HD:Applications:myFolder:
Which is what I want.
It works fine on my powerbook g4 w/ tiger, a friends intel macbook w/ tiger… But not a macbook w/ leopard.
Does leopard not like the fact that I have spaces in my app name? Or is it something else?
set appsPath to path to me as string
set the myPath to appsPath
set the myPath to replace_chars(appsPath, "My Path Tester.app:", "") -- function not shown in this snippet, but you can figure out what it does
display dialog "This is the path to prefs from the main app ->
" & myPath