std.file.fileType
FreeSlave
freeslave93 at gmail.com
Fri Oct 4 01:26:59 PDT 2013
On Friday, 4 October 2013 at 08:06:24 UTC, simendsjo wrote:
> On Friday, 4 October 2013 at 07:39:36 UTC, FreeSlave wrote:
>> I was suggested to bring this idea up here.
>>
>> fileType should be a function for determining of file type.
>>
>> Example of usage:
>> Suppose application uses special directory for plugins (i.e.
>> dynamic libraries). In graphics user interface it can be
>> reflected like list of checkboxes that show which plugins are
>> on and which are off. To implement this we should know that
>> file actually represents dynamic library without trying to
>> load it into executable memory. Yes, we can load and unload
>> every file in place to check that it's valid dynamic library
>> but it's some kind of hack.
>>
>> Another example is file manager. It has icons for the most
>> common file types and usually relies on file extension to
>> determine which icon should be used. But we can't always rely
>> on extension. For example many games use .pk3 extension as
>> alias to .zip, but file manager know nothing about it and
>> shows these files like ones with unknown extension.
>>
>> So how do you think does phobos need these capabilities? May
>> be you have other examples where this function can be useful.
>
> Seems a bit specific to be put in the standard library. If you
> don't mind GPL, you can look at the source for file:
> http://www.darwinsys.com/file/
Ok, I'll check it out.
I've just called to mind another use, the most important I think.
It's for web services to prevent from uploading possibly harmful
files (executables) or to check service support for given file.
More information about the Digitalmars-d
mailing list