January 30, 2012 Re: Compile time filesystem access? | ||||
|---|---|---|---|---|
| ||||
Only with `enum xmldata = import("file.xml");`, but you have to pass the -J switch and a directory path for the location of the file. E.g.:
module test;
enum xmldata = import("file.xml");
void parse(string data)() { }
void main() {
parse!(xmldata)();
}
$ dmd -J. test.d
"." is short for the current dir of course.
| ||||
January 30, 2012 Re: Compile time filesystem access? | ||||
|---|---|---|---|---|
| ||||
Rather short docs since it's a simple feature: http://www.d-programming-language.org/expression.html#ImportExpression | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply