[Haskell-cafe] Re: File path programme
Keean Schupke
k.schupke at imperial.ac.uk
Mon Jan 24 04:33:31 EST 2005
Marcin 'Qrczak' Kowalczyk wrote:
>These rules agree on "foo", "foo." and "foo.tar.gz", yet disagree on
>"foo.bar."; I don't know which is more natural.
>
>
Filename extensions come from DOS 8.3 format. In these kind of
names only one '.' is allowed. Unix does not have filename extensions,
as '.' is just a normal filename character (with the exception of
'.', '..', and filenames starting with a '.' which are hidden files).
As far as I know unix utilities like gzip look for specific extensions
like '.gz',
so it would make more sense on a unix platform to just look for a filename
ending '.gz'... this applies recursively so:
fred.tar.gz
Is a tarred gzip file, so first ending is '.gz' the next is '.tar'...
So as far as unix is concerned:
"foo.bar." is just as it is... as would any other combination unless the
extension
matches that specifically used by your application...
So the most sensible approach would be to have a list of known
extensions which can be
recursively applied to the filenames, and leave any other filenames alone.
[".gz",".tar",".zip"] ...
In other words just splitting on a '.' seems the wrong operation.
(Imagine gziping a file
called "a..." you get "a....gz", in other words simply an appended ".gz")
Keean
More information about the Haskell-Cafe
mailing list