Don't use deprecated filename; instead use URL.
Refer to a file using fileSystemRepresentation: this will correctly escape non-ascii characters.
Define NSInteger if using 10.4 or earlier.
Have openPanelDidEnd:returnCode:contextInfo: use an NSInteger instead of int so that the signature matches what the NSOpenPanel delegate expects.