Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import text file to code in D

Tags:

compilation

d

I'm doing some shader programming in D, and what I want to do is write my shaders in text files, but during compilation have the text files be put into the executable / library, just like a normal string would.

Is there a way to do this in D?

like image 798
Jeroen Avatar asked Apr 14 '26 05:04

Jeroen


1 Answers

You can use Import Expressions.

string shaderText = import("shader.txt");

Make sure you use the -J compiler switch to supply the directory of the shader.

like image 84
Peter Alexander Avatar answered Apr 18 '26 10:04

Peter Alexander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!