Re: How to choose file without extension in NSOpenPanel
Re: How to choose file without extension in NSOpenPanel
- Subject: Re: How to choose file without extension in NSOpenPanel
- From: "David W. Halliday" <email@hidden>
- Date: Sat, 19 Jan 2002 14:48:23 -0600
- Organization: Latin AmeriCom, formerly Latino Online
Joe Chan wrote:
>
It is so typically the case that right after I fired off a
>
question I found the answer. I can use
>
NSFileTypeForHFSTypeCode() to get the equivalent "extension" for
>
a type code to put into the file type array for NSOpenPanel.
>
Sorry for stupid question.
>
>
> I have one simple question about NSOpenPanel: how do I choose
>
> files without extension (or ignoring the extension), but has a
>
> four char type code set? What I want to do is to choose files
>
> with type code 'TEXT', regardless of it's extension (from no
>
> extension to .c, .l, .hqx, .plist, whatever). NSOpenPanel only
>
> lets me specify only a list of file extensions. One way I can
>
> do it is to use Nav Services in Carbon, but I'd rather not.
>
>
-----------
>
Joe Chan
>
...
The "real" problem is in the way so many people "assume" that the "file type" in
the Cocoa/YellowBox/OpenStep/NextStep APIs is a file name extension, simply because
it has, typically, been implemented as such. The "reality" is that it's an
"abstract" representation of the file/content type (see also the Pasteboard APIs).
If we can wean people, including ourselves, off this (accidental) implementation
detail, we'll be better positioned for Apple to make the transition to a more
abstract concept of file/content type that can be mapped to several different file
system type designations. (The foundation is already laid in the Info Plists. It
simply needs to be better tied into the APIs [Coca APIs are probably better prepared
for this than the Carbon APIs]. However, I would also like to see a type hierarchy
mechanism integrated into this type system so we aren't at the mercy of several
different abstract type names for the same fundamental type, as well as being able
to detect that a derived type, such as HTML, is still a lower level type, like TEXT,
that many more applications can handle.)
Just my thoughts.
David email@hidden