std.file.fileType

FreeSlave freeslave93 at gmail.com
Fri Oct 4 00:39:34 PDT 2013


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.


More information about the Digitalmars-d mailing list