Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Neia Neutuladh via Digitalmars-d-learn
On Mon, 10 Dec 2018 17:58:32 +, aliak wrote: > string parseConfig(string str) { >string ret; >foreach (line; str.split("\n")) { > auto parts = line.split("="); > ret ~= `string ` ~ parts[0] ~ ` = "` parts[2] `";`; >} >return ret; > } That works as long as none of the

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Narxa via Digitalmars-d-learn
On Monday, 10 December 2018 at 17:47:37 UTC, Neia Neutuladh wrote: On Mon, 10 Dec 2018 11:08:23 +, Narxa wrote: Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In your build script, echo the environment variable

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread aliak via Digitalmars-d-learn
On Monday, 10 December 2018 at 11:08:23 UTC, Narxa wrote: Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In FreePascal, it can be done by defining it in source as: VALUE_OF_SOMETHING = {$I %SOMETHING%}; And I can

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Neia Neutuladh via Digitalmars-d-learn
On Mon, 10 Dec 2018 11:08:23 +, Narxa wrote: > Hello, people! > > I would like to have a constant with the value of some environment > variable that is defined at compile time. In your build script, echo the environment variable into a file. Then import() that file and use the value. > I

How to set constant value to environment variable at compile time?

2018-12-10 Thread Narxa via Digitalmars-d-learn
Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In FreePascal, it can be done by defining it in source as: VALUE_OF_SOMETHING = {$I %SOMETHING%}; And I can call the compiler with (bash): SOMETHING='Anything' export