Proposal for std.path replacement

Nick Sabalausky a at a.a
Mon Mar 7 15:09:11 PST 2011


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.2298.1299479088.4748.digitalmars-d at puremagic.com...
> On Sunday 06 March 2011 22:09:22 Nick Sabalausky wrote:
>> "Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message
>> news:mailman.2280.1299459971.4748.digitalmars-d at puremagic.com...
>>
>> > This reminds me. I should look into mime types one of these days to see
>> > what the
>> > appropriate way (if any) would be to put support for them in Phobos. It
>> > would be
>> > nice to not have to go by extension for the few programs that I have
>> > which have
>> > to worry about file type.
>>
>> I'm no unix expert, but my understanding is that mime types in the
>> filesystem don't even exist at all, and that what it *really* does is use
>> some complex black-box-ish algorithm that takes into account the first 
>> few
>> bytes of the file, the extention, the exec flag, and god-knows-what-else 
>> to
>> determine what type of file it is. Contrary to how people keep making it
>> sound, mime type is *not* the determining factor (and cannot possibly 
>> be),
>> but rather nothing more than the way the *result* of all that analysis is
>> represented.
>
> I thought that the first few bytes of the file _were_ the mime type. 
> Certainly,
> from what I've seen, extension has _no_ effect on most programs. Konqueror
> certainly acts like it does everything by mime type - file associations 
> are set
> that way.
>

No, MIME is a text-based filetype-naming system thst originated from SMTP 
and then got adopted by HTTP and various other things. It's like a really 
verbose file extension that isn't stored as part of the filename. These are 
some MIME types:

application/json
application/soap+xml
application/xhtml+xml
application/x-gzip
image/jpeg
text/plain
text/xml
video/mp4
application/x-www-form-urlencoded

More info:
http://en.wikipedia.org/wiki/Mime_type






More information about the Digitalmars-d mailing list