String import an entire directory

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Nov 11 15:00:03 UTC 2017


On Saturday, November 11, 2017 14:11:50 Neia Neutuladh via Digitalmars-d 
wrote:
> At my job, I put together a database migration tool for our
> services. It scans for resources in your JAR file with an
> appropriate path, interprets them as SQL scripts, and applies
> them to the database if it hasn't been done yet.
>
> I want to implement this in D. However, while D allows you to
> import individual files, it doesn't let you import an entire
> directory.
>
> I can make a prebuild script to generate code for this, but I'm
> wondering: do other people find themselves needing this
> periodically? If so, I can write a DIP for it, or at least
> publish a codegen tool that other people can use.

You could always generate a file with the list of files that you want to
import and then use that to generate the import statements to import each
file. If you're already doing something to generate all of these files to
import, I wouldn't think that it take much to just generate a file with the
list of files while you're at it.

- Jonathan M Davis



More information about the Digitalmars-d mailing list