a.out vs .app bundles
a.out vs .app bundles
- Subject: a.out vs .app bundles
- From: Gregor Nobis <email@hidden>
- Date: Fri, 15 Mar 2002 19:22:48 +0100
(This is somewhat related to "window focus trouble" which I posted Sun,
March 03, 2002)
I'm looking for an explanation for the following:
With a tiny app I wrote (that has virtually no funcionality, it just
opens up a window containing an NSTextField) I did some experiments.
1) I had ProjectBuilder build it with all the settings at their default
values for a new Cocoa Application project. It ran just fine.
2) I launched the executable located in MyApp.app/Contents/MacOS/ from
the terminal. Apart from starting up in the background, it runs fine,
too.
3) I moved the executable out of the .app bundle and ran it. Oops. It
does not run fine at all but like this:
(this is how it's related to my above mentioned posting to this list)
a)The window gets created and opened all right. But neither does it
order front nor become key. Clicking inside the
window will bring it to the front, the NSTextField inside it gets a
focus ring and everything looks fine. Except:
b) The terminal window's close, resize and minimize widgets remain
colored and it's title bar remains opaque as if it still were in front.
The new window's widgets and title bar do the same. So there seem to be
two frontmost windows.
c) Typing will not result in text added to the NSTextField but text
entered in the Terminal window.
d) To get the window to behave the normal way, you have to click its
title bar. It then gets the keyboard input and the terminal window
becomes a normal inactive window.
I guessed the missing information from info.plist or pkginfo would be
the reason. But only until I tried the following:
4) I compiled my main.m (the only source file) like this: cc -framework
Cocoa main.m
Doing ./a.out in the terminal launched an app with the same problem as
described under 3)
5) I moved a.out to Contents/MacOS/ created in an empty "wannabe-
bundle"-folder testApp.app that contained no other files. Then, in the
terminal in ~/Documents/testApp.app/Contents/MacOS/ I did ./a.out -
surprise: myApp runs just fine again. No nib file, no info.plist, no
pkginfo, no nothing. (Double-clicking the bundle in the Finder only
opens the folder, of course.)
Now here's my Question: Is there a way to run a.out without the bundle
structure around it, that will make the app act normal? I guess it might
have something to do with my main function not calling NSApplicationMain
but [NSApplication sharedApplication] and [NSApp run] instead, not sure,
though.
Oh, and there is more thing: How come the above mentioned app does not
have a menu bar whenever the keyboard menu is not shown (due to only one
layout being selected in it's pref pane) but gets one (containing the
apple menu and the generic application menu) when the keyboard menu is
shown? Keyboard equivalents for the menu items work either way.
Just in case you want to take a look at that wacky piece of code I
wrote - it's here:
http://www.g-nobis.de/main.m.gz (it's a version with
an NSBox instead of NSTextField)
Any help and thoughts are greatly appreciated,
Gregor
_______________________________________________
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.