realbasic-nug
[Top] [All Lists]

Re: FileType OS X RB2006r2

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: FileType OS X RB2006r2
From: Jonathan Johnson <jonj at realsoftware dot com>
Date: Tue, 25 Apr 2006 16:55:32 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060425204130 dot BEBF8731AE at hoggle dot dreamhost dot com> <19ED2A60-9CA9-483E-A594-5B1A2EC61E07 at xhtmlsoft dot com> <3D4B2126-465B-43F1-AB4D-F8622C29A6E6 at realsoftware dot com> <3CDC428E-3F02-4E80-B425-0DE71E391F9E at xhtmlsoft dot com>

On Apr 25, 2006, at 4:38 PM, Sven E Olsson wrote:


On 25 apr 2006, at 23.26, Jonathan Johnson wrote:


On Apr 25, 2006, at 4:19 PM, Sven E Olsson wrote:

extension to jpg .. and then you have an none valid file, that NOT would be displayed in the OpenDialog box as MacType TEXT because there is no MacType.

Of course, the reason to support MacTypes is because you can also blindly remove the extension entirely. If you have a file that *does* have a MacType that is correct, and you specify both a MacType and extension, it will work properly in all cases. If you simply specify a dummy MacType, it won't work if the file ends up without an extension, because you didn't specify a MacType that matched.

-Jon

This is very interesting, could an xml file (vaild) have another extension that .xml or none?

Yes. Xhtml comes to mind, rss feeds, etc.

Could an valid html file have an extension .txt ? or .jpg?

Yes, it could, depending on how it was written.

The moral of the story is while all what Joe is suggesting will help filter files more accurately and more to the common experience on the Macintosh, you should never rely on the extension or MacType when reading a file. Instead, as you're opening the file, try to examine the data to figure out what format it's in. Most files have a few bytes up front that serve as a "magic" code.

-Jon
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>