On Monday, 11 February 2019 at 00:54:27 UTC, Seb wrote:
On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote:

[...]

You can't read or list files at compile-time.

dmd can read files at compile time using the import function [1]

What are you trying to do?

Incorporate HTML template files into a CGI binary. After putting [ and ] around the list in LS this works:

```TemplateStore.d
module TemplateStore;
import std.path;
import std.conv;
import std.file;

immutable string[string] template_map;

static this ()
{
   immutable LS = import (`LS`);
   immutable template_files = mixin(LS);

   static foreach (f; template_files) {
      pragma (msg, `reading template <` ~ f ~ ">");
      template_map[f] = import (f);
   }
}
```

[1] https://forum.dlang.org/thread/njnwacxnvxlwlpjcu...@forum.dlang.org

Reply via email to