On Sunday, 2 February 2014 at 17:17:14 UTC, bearophile wrote:
Gary Willoughby:

How do you access that at runtime?

In the usual ways. A hex string is just a different kind of literal for a string (so if you need hex data you need to cast it, unfortunately). The mixin(import("...")) can import anything, including your base64 data, that you can convert at compile-time or run-time in what you need.

Bye,
bearophile

Ah right i see what you mean. Something like this:

template embed(string file)
{
        private string getData()
        {
                return Base64.encode(cast(ubyte[])import(file));
        }

        enum embed = getData();
}

Reply via email to