Jump to page: 1 2 3
Thread overview
Re: Well, it's been a total failure
Sep 14, 2010
bearophile
Sep 15, 2010
Justin Johansson
Sep 15, 2010
Justin Johansson
Sep 15, 2010
Jonathan M Davis
Sep 15, 2010
Nick Sabalausky
Sep 15, 2010
Jérôme M. Berger
Sep 15, 2010
retard
Sep 16, 2010
KennyTM~
Sep 16, 2010
Jérôme M. Berger
Sep 16, 2010
Jérôme M. Berger
[OT] File type on UNIX
Sep 16, 2010
KennyTM~
Sep 17, 2010
Jérôme M. Berger
Sep 17, 2010
Jonathan M Davis
Sep 18, 2010
KennyTM~
Sep 20, 2010
Jérôme M. Berger
Sep 20, 2010
KennyTM~
Sep 20, 2010
Jérôme M. Berger
Sep 20, 2010
Jonathan M Davis
Sep 20, 2010
KennyTM~
Sep 20, 2010
retard
Sep 15, 2010
retard
Sep 15, 2010
Jonathan M Davis
Sep 16, 2010
Nick Sabalausky
Sep 16, 2010
Lutger
Sep 16, 2010
Nick Sabalausky
Sep 16, 2010
Jacob Carlborg
September 14, 2010
Andrei Alexandrescu:

> I didn't know there is an executable attribute on Windows.

If you rename a txt file as .exe, if you click on it Windows tries to run it.


> This reminds me of the discussion of yesteryear - people were complaining about C++ files in dmd having the .c extension, and the right answer would have been to change the blessed thing to be like everybody else has it, instead of finding arguments on why it worked the way it was.

+1, despite there is more than one way to give suffix to C++ files.
There is a bug report on this, not written by me.
Having source code simple, clean, tidy, and readable is important for all open source projects, because that increases the probability of finding collaborators. Giving a sensible suffix to files is a starting point for that.

Bye,
bearophile
September 15, 2010
On 14/09/2010 11:07 AM, bearophile wrote:
> Andrei Alexandrescu:
>
>> I didn't know there is an executable attribute on Windows.
>
> If you rename a txt file as .exe, if you click on it Windows tries to run it.
>
>
>> This reminds me of the discussion of yesteryear - people
>> were complaining about C++ files in dmd having the .c extension, and the
>> right answer would have been to change the blessed thing to be like
>> everybody else has it, instead of finding arguments on why it worked the
>> way it was.
>
> +1, despite there is more than one way to give suffix to C++ files.
> There is a bug report on this, not written by me.
> Having source code simple, clean, tidy, and readable is important for all open source projects, because that increases the probability of finding collaborators. Giving a sensible suffix to files is a starting point for that.
>
> Bye,
> bearophile

There is not a lot of use in creating your own "readable" file suffices
(alla file extensions).  Unless your file extension is known on the
platform you are using then there may be no hope of reasonable opening
your file with the requisite application on another platform.

Say if your name was Robin, would you name your text files as .bat ?

Holy Gotham (says Batman), am I to know what application to open that with?

Cheers,
Justin Johansson


September 15, 2010
On 15/09/2010 10:38 PM, Justin Johansson wrote:
> There is not a lot of use in creating your own "readable" file suffices
> (alla file extensions). Unless your file extension is known on the
> platform you are using then there may be no hope of reasonable opening
> your file with the requisite application on another platform.
>
> Say if your name was Robin, would you name your text files as .bat ?
>
> Holy Gotham (says Batman), am I to know what application to open that with?
>
> Cheers,
> Justin Johansson
>

Of course the Penguin always know how to open a file ...
especially for evil purposes :-)
September 15, 2010
On Wednesday, September 15, 2010 06:08:49 Justin Johansson wrote:
> On 14/09/2010 11:07 AM, bearophile wrote:
> > Andrei Alexandrescu:
> >> I didn't know there is an executable attribute on Windows.
> > 
> > If you rename a txt file as .exe, if you click on it Windows tries to run it.
> > 
> >> This reminds me of the discussion of yesteryear - people
> >> were complaining about C++ files in dmd having the .c extension, and the
> >> right answer would have been to change the blessed thing to be like
> >> everybody else has it, instead of finding arguments on why it worked the
> >> way it was.
> > 
> > +1, despite there is more than one way to give suffix to C++ files.
> > There is a bug report on this, not written by me.
> > Having source code simple, clean, tidy, and readable is important for all
> > open source projects, because that increases the probability of finding
> > collaborators. Giving a sensible suffix to files is a starting point for
> > that.
> > 
> > Bye,
> > bearophile
> 
> There is not a lot of use in creating your own "readable" file suffices (alla file extensions).  Unless your file extension is known on the platform you are using then there may be no hope of reasonable opening your file with the requisite application on another platform.
> 
> Say if your name was Robin, would you name your text files as .bat ?
> 
> Holy Gotham (says Batman), am I to know what application to open that with?
> 
> Cheers,
> Justin Johansson

If you're on a non-Windows system, the mime-type becomes far more important than the extension. Most programs in Linux (and I believe MacOS X as well) don't care about the extension. They just look at the mime type. Extensions become almost entirely a thing for the user. So, whether your file is useable becomes more of an issue of known mime type than known extension. Still, you don't generally want to just be making up extensions.

- Jonathan M davis
September 15, 2010
"Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
>
> If you're on a non-Windows system, the mime-type becomes far more
> important than
> the extension. Most programs in Linux (and I believe MacOS X as well)
> don't care
> about the extension. They just look at the mime type. Extensions become
> almost
> entirely a thing for the user. So, whether your file is useable becomes
> more of
> an issue of known mime type than known extension. Still, you don't
> generally
> want to just be making up extensions.
>

I didn't think unix file systems had a concept of mime type.


September 15, 2010
Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
>> If you're on a non-Windows system, the mime-type becomes far more
>> important than
>> the extension. Most programs in Linux (and I believe MacOS X as well)
>> don't care
>> about the extension. They just look at the mime type. Extensions become
>> almost
>> entirely a thing for the user. So, whether your file is useable becomes
>> more of
>> an issue of known mime type than known extension. Still, you don't
>> generally
>> want to just be making up extensions.
>>
> 
> I didn't think unix file systems had a concept of mime type.
> 
	It doesn't, but Unix tools use the file contents to determine the
mime type and then choose the app associated to the mime type.

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



September 15, 2010
Wed, 15 Sep 2010 15:48:32 -0400, Nick Sabalausky wrote:

> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
>>
>> If you're on a non-Windows system, the mime-type becomes far more
>> important than
>> the extension. Most programs in Linux (and I believe MacOS X as well)
>> don't care
>> about the extension. They just look at the mime type. Extensions become
>> almost
>> entirely a thing for the user. So, whether your file is useable becomes
>> more of
>> an issue of known mime type than known extension. Still, you don't
>> generally
>> want to just be making up extensions.
>>
>>
> I didn't think unix file systems had a concept of mime type.

Yep, they don't. The new file systems like reiserfs have support for arbitrary metadata fields, IIRC. But for example the standard Linux distributions have their mime/extension associations in /etc/mime.types
September 15, 2010
Wed, 15 Sep 2010 22:35:27 +0200, Jérôme M. Berger wrote:

> Nick Sabalausky wrote:
>> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
>>> If you're on a non-Windows system, the mime-type becomes far more
>>> important than
>>> the extension. Most programs in Linux (and I believe MacOS X as well)
>>> don't care
>>> about the extension. They just look at the mime type. Extensions
>>> become almost
>>> entirely a thing for the user. So, whether your file is useable
>>> becomes more of
>>> an issue of known mime type than known extension. Still, you don't
>>> generally
>>> want to just be making up extensions.
>>>
>>>
>> I didn't think unix file systems had a concept of mime type.
>> 
> 	It doesn't, but Unix tools use the file contents to determine the
> mime type and then choose the app associated to the mime type.

Unix tools?
September 15, 2010
On Wednesday, September 15, 2010 12:48:32 Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
> 
> > If you're on a non-Windows system, the mime-type becomes far more
> > important than
> > the extension. Most programs in Linux (and I believe MacOS X as well)
> > don't care
> > about the extension. They just look at the mime type. Extensions become
> > almost
> > entirely a thing for the user. So, whether your file is useable becomes
> > more of
> > an issue of known mime type than known extension. Still, you don't
> > generally
> > want to just be making up extensions.
> 
> I didn't think unix file systems had a concept of mime type.

They don't have a concept of file extension either. Mime types has to do with the contents of the file and file extensions has to do with the name of the file. It's programs which interpret those, not the file system. Typically, on Windows, the extension is used by the OS to determine which program to use to open a file. In unix, it's the mime type that's used to determine that.

The one bit of overlap there is the fact that Windows treats the exe extension essentially the way that unix treats the executable file attribute.

Now, I wouldn't advise ditching file extensions in unix, since it not only can help the human using them but there are occasionally programs which check the extension rather the mime type (so, ultimately, you may end up using both the extension and the mime type), but it's primarily the mime type which is used, and it's definitely the mime type which is used to determine which program to use to open a file in the desktop environments.

- Jonathan M Davis
September 16, 2010
"Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.227.1284590189.858.digitalmars-d@puremagic.com...
> On Wednesday, September 15, 2010 12:48:32 Nick Sabalausky wrote:
>> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.225.1284568096.858.digitalmars-d@puremagic.com...
>>
>> > If you're on a non-Windows system, the mime-type becomes far more
>> > important than
>> > the extension. Most programs in Linux (and I believe MacOS X as well)
>> > don't care
>> > about the extension. They just look at the mime type. Extensions become
>> > almost
>> > entirely a thing for the user. So, whether your file is useable becomes
>> > more of
>> > an issue of known mime type than known extension. Still, you don't
>> > generally
>> > want to just be making up extensions.
>>
>> I didn't think unix file systems had a concept of mime type.
>
> They don't have a concept of file extension either. Mime types has to do
> with the
> contents of the file and file extensions has to do with the name of the
> file. It's
> programs which interpret those, not the file system. Typically, on
> Windows, the
> extension is used by the OS to determine which program to use to open a
> file. In
> unix, it's the mime type that's used to determine that.
>
> The one bit of overlap there is the fact that Windows treats the exe
> extension
> essentially the way that unix treats the executable file attribute.
>
> Now, I wouldn't advise ditching file extensions in unix, since it not only
> can
> help the human using them but there are occasionally programs which check
> the
> extension rather the mime type (so, ultimately, you may end up using both
> the
> extension and the mime type), but it's primarily the mime type which is
> used,
> and it's definitely the mime type which is used to determine which program
> to use
> to open a file in the desktop environments.
>

Yea, but my question was more "how in the hell would it know the mime type of a file in the first place?" It's obviously not stored in the filename, and 99.9% is the time it's not stored in the file's data either.

Since then, someone mentioned it typically analyses the content of the file and infers the mime type based on that. That's news to me. It would seem limited and error-prone though, so I have a hard time believing it doesn't suppliment that content-analysis with extension-checking in many cases.


« First   ‹ Prev
1 2 3