Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: now it really gets weird



On Thursday, July 17, 2003, at 11:14 AM, Eliah Kagan wrote:

In fact, if you make a new folder and call it something ending in .app, and then you double click on it in the Finder, it will look just like an app starting up. It just won't do anything.

Since we're elaborating...

What the Finder actually does at this point is look for a file inside the package (the .app folder) called Contents/Info.plist. If it finds one, it does reads it and acts accordingly. (A full discussion of what Info.plist is and does is beyond the scope of my knowledge, plus it's tangential to where I'm going with this.)

If there's no Info.plist file, the Finder looks for any file at the path Contents/MacOS/PackageBaseName and tries to execute it. What I mean by that is that if you've got a package called "Hello.app" and you double-click it, the Finder will look for Hello.app/Contents/Info.plist first, then barring that it will look for Hello.app/Contents/MacOS/Hello and try to execute it.

This is handy to know because you can put ANY executable file, even a shell or Perl script or whatever, and put it inside a package to make it double-clickable. If you do this, the file that gets executed is simply exec'd by the Finder; it doesn't get a controlling terminal or anything fancy-schmancy like that. Sometimes this is what you want.

The only catch is that Hello.app/Contents/MacOS/Hello (or whatever) has to be executable. In other words, the execute bit has to be set.

--
email@hidden
http://homepage.mac.com/jharrell
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: now it really gets weird (From: Eliah Kagan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.