• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to choose file without extension in NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to choose file without extension in NSOpenPanel


  • Subject: Re: How to choose file without extension in NSOpenPanel
  • From: Joe Chan <email@hidden>
  • Date: Sat, 19 Jan 2002 22:08:29 -0500

I do agree that the file type as an abstract concept rather than tied down to file extension is very attractive. I think the assumption that file type equates to file extension is unwisely propagated by what limited documentation that Apple provides: every mention of file type in the Cocoa docs is immediately followed by file extensions. Personally, what I would like to have in NSOpenPanel is to have a delegate method that let me decide what is selectable and what is not, in addition to be able to pass in an NSArray.

On Saturday, January 19, 2002, at 03:48 PM, David W. Halliday wrote:

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


  • Follow-Ups:
    • Re: How to choose file without extension in NSOpenPanel
      • From: Jim Correia <email@hidden>
References: 
 >Re: How to choose file without extension in NSOpenPanel (From: "David W. Halliday" <email@hidden>)

  • Prev by Date: SEL and NSSelectorFromString
  • Next by Date: Re: message to nil? (very basic question)
  • Previous by thread: Re: How to choose file without extension in NSOpenPanel
  • Next by thread: Re: How to choose file without extension in NSOpenPanel
  • Index(es):
    • Date
    • Thread