On Mon, Jan 8, 2018 at 11:38 PM, Graeme Geldenhuys via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Then it seems Windows Explorer is right up your alley. :) They hide the
file extension by default. Users (like me) have to explicitly go into the
settings and enable "show file extensions" option.

I do the same as i dislike having the extensions hidden. I want them to be
short, not hidden. Also you see file lists in more places than a file
manager - a common one being version control programs.

> Even better, Linux and FreeBSD don't even need file extensions. File
Extensions are simply for [some] human benefit (unlike Windows that
requires them). Linux and FreeBSD OS's query the first 4-8 bytes of a file
to accurately determine the file type and use the appropriate application
to open them.

Not really. Linux, FreeBSD or any other Unix OS have no idea about file
types beyond executable files (and that is set via the executable bit).
Application association is something desktop environments concern
themselves with. KDE and GNOME back in the 90s decided to use MIME types
together with an association database based on globs and eventually they
decided to create a common database through the freedesktop.org project.
Today most (but not all) desktop environments tend to simply use this
shared database which does the association from file to MIME type using
several approaches, including globs and magic byte sniffing, depending on
each type. In fact the recommended approach is to first match by glob and
if that fails or produces conflicting results (e.g. two types claim a
single file) only then to try to check the file's contents.

You can read the full spec here:
https://specifications.freedesktop.org/shared-mime-info-spec/0.18/ar01s02.html#idm139750558222816

Although note that this is just a convention and not a standard
(freedesktop is not a standards body, it just happens to be popular enough
due to being made by KDE and GNOME during their most popular days) - other
desktop environments or programs do their own thing and more often than not
this thing is based on pattern matching filenames for their extensions. It
makes sense after all since opening a file to read its contents would be
much slower - especially when done through network filesystems - than
simply checking the filename, which is why the content checking part is
used as a fallback instead of the primary way to determine the file
contents (some file managers even ignore the magic part if they are
browsing a network FS). And magic data do not really help with multipurpose
file formats like containers - how are you going to tell the difference
between a Java JAR, Java WAR and a LibreOffice ODT file when all are ZIP
files? - or text files like JSON, Plist, INI and several others that are
used for special purpose storage. Hell, you don't even need to look much
further than Lazarus here: packages, projects and session files (and
perhaps other stuff) are simple XML files and all of them even have the
same root node and no namespace configuration, so you cannot really
separate them from each other from anything else than the extension.

This "extension isn't a unix thing" wasn't even true in the days of the
original Unix - extensions were used all over the place there too as they
often were useful for shell scripts. The only system (that i know of) that
really didn't need extensions was the classic MacOS which simply stored the
file type as metadata and used that to decide what to do with the file.
-- 
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to