Hi, I was wondering if anyone knew how to pull a path out of an apple
bundle.
I've packaged a program in an apple bundle (which is really just a
file) and I'm letting people start it via the user interface. The
trouble is, there are dependent files, both other tcl files and files
that require processing. I access these files both through TCL commands
and exec commands, like CP and such. The trouble is, once the program
starts, it's not sensitive to the starting path.
I've tried a number of things to get it. If I use the TCL pwd or 'exec
pwd' I get '/' as the response. If I use 'file dirname [program]', I
get '.' as a reply. I finally got it to work by pulling it directly
from the PID:
---snip---
set procLoc [exec ps -p [pid] -o command]
set clean1 [string first / $procLoc]
set clean2 [string last MacOS $procLoc]
set clean2 [expr $clean2 - 1]
set procLoc [string range $procLoc $clean1 $clean2]
cd $procLoc/Resources
---snip---
But the process seems unwieldy and the results are flakey. Anyone know
of a good way to do this? Either in the bundle information (info.plist)
or within the program itself?
I'd really prefer not to make the path static (e.g.
/Applications/Application.app/Contents/)
Thanks,
Brett
Received on Sun Apr 30 02:16:04 2006