On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:
I want to add version to my program.
I have configurated my version file "version.txt", but I dont
know how link this file to my program. If Need spec file,
please send the exemple code of spec. Or is is possible add
version file by dmd command line or resources. Thank you.
I'm not sure I know what you're asking, but maybe this is
the answer.
In version.txt:
0.1.0 - a version example
In version.d:
import std.string : chomp;
immutable Version = import("version.txt").chomp;
void main() {
import std.stdio : writeln;
writeln("Version: ", Version);
}
To compile and run with both files in the current directory:
dmd -J. -run version
With output:
Version: 0.1.0 - a version example
The corresponding dub setting is probably stringImportPaths