OS X & answer file

Alex Rice alrice at ARCplanning.com
Tue Mar 18 03:03:01 EST 2003


On Monday, March 17, 2003, at 11:53  PM, Ken Ray wrote:

> Yes, I've noticed that periodically. It isn't consistent in my
> experience, but it's damn annoying.

There were are a lot of debates about this on cocoa-dev and macosx-dev 
and such mailing lists. I think Apple's concept of how to deal with 
file-to-application bindings was evolving right up till the release of 
Jaguar, so now you have this kind of schizoid situation where some 
developers do extensions only, some do creator codes only, and some do 
both.

If Rev were to try to accommodate, and I think it should, (every time I 
check out a .rev file out my version control system, it's creator code 
gets stripped, and it's not available in Rev's open dialog) Here is a 
good model to follow:

Cocoa has macros for an open file dialog, with filters for file 
extensions AND creator codes.  There is what seems like a combinatorial 
explosion of file types for the programmer :-) but it does the job.

int result;
NSArray *fileTypes = [NSArray arrayWithObjects:
             @"png", @"jpg", @"jpeg", @"tiff",
             @"tif", @"pdf", @"eps", @"gif", @"pict", @"bmp",
             NSFileTypeForHFSTypeCode( 'PNG' ),
             NSFileTypeForHFSTypeCode( 'PGNf' ),
             NSFileTypeForHFSTypeCode( 'JPEG' ),
             NSFileTypeForHFSTypeCode( 'TIFF' ),
             NSFileTypeForHFSTypeCode( 'PDF' ),
             NSFileTypeForHFSTypeCode( 'GIFf' ),
             NSFileTypeForHFSTypeCode( 'PICT' ),
             nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
result = [oPanel runModalForTypes: fileTypes];


Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the use-livecode mailing list