On Saturday, 18 March 2017 at 11:29:43 UTC, alex1974 wrote:
I want to build a custom library with useful extensions to phobos. They should be named like:

extensions.regex
extensions.path
extensions.files
...

Some libraries, like extensions.files contain several files (e.g files.d, filesexceptions.d)

Analog to phobos I would like to import them like
import extensions.files: temporary;

What would be the best approach for the folder layout and dub?
I guess subPackages, but I can't get them to compile and link properly.

Thanks for the help

You can put everything in a single library. The module names should match to the folder layout:

extensions/regex.d                    // module extensions.regex;
extensions/path.d                     // module extensions.path;
extensions/files/package.d            // module extensions.files;
extensions/files/files_stuff1.d // module extensions.files.files_stuff1; extensions/files/files_stuff2.d // module extensions.files.files_stuff2;

Note the particular case of package.d. To have a module with the same name as a folder you name it package.

Reply via email to