Re: Detecting attachment types by file extension.. how to change exmh's behaviour?

Sean Kamath <[email protected]>
Newsgroups gmane.mail.exmh.user
Message-ID <[email protected]>
On May 24, 2007, at 7:04 AM, Ken Hornstein wrote:

>> I don't have much experience with MacOS-X but it looks to me like the
>> problem is with /usr/bin/open and not with exmh.  I've never heard  
>> of a
>> unix command that operates based on file extensions before (rather  
>> than
>> determining type based on file contents (eg file)).
>
> Well, you have now.  I also occasionally use exmh under MacOS X, and
> I run into the same problem.
>
> Right or wrong, MacOS X made the concious decision to determine  
> file type
> by file extension (I read the article describing that decision and  
> I at
> least understood their reasoning; they had a lot of issues to deal  
> with).
> open is not a simple shell script; it's a program which uses the  
> registered
> application to open a particular file.  While it's possible for you to
> run the correct application directly, open(1) makes life so much  
> easier.

True, open will use the associations between extension and file type  
(it uses LaunchServices), but it will also use the resource fork, if  
one is provided (which usually isn't the case).  You could use  
SetFile (available with the Developer Tools) to set the creator and  
type, but then you would need to decide on all the 'owners' of the  
types of files.

BTW: The Windows equivalent is 'start'.  I think.  I avoid it  
(Windows) like the plague.

Regarding the naming of temporary files before opening them, it seems  
to me that you can never truly prevent stupidity.  You'll have b0rked  
mailers that will use octet-stream (and we know who we're talking  
about) that require the use of the name to determine the type, and  
you'll have conflicting types and names for other reasons.

So my suggestion is that the client control what is done.  On Windows  
and MacOS X, for better or worse, it's file extension that matters.   
So using the name (with some checking for / and other magic  
characters) on them is OK.  On somewhat more traditional unices, such  
as *BSD/Linux/Solaris, it's fine to handle things the way they are  
handled now. . . But I am finding some apps that are unhappy about  
opening a file that doesn't have the proper extension on my Linux  
box. . .(The pop up a dialog box saying "are you sure?")

My $0.02.

Sean
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.