Hi there, I would like to permanently store some data in environment variables. I'm running the code with nim-0.17.2 on windows, and I'm fine storing data as user environment variables.
The data is not visible outside of the nim application, and it's not available when I run the program for the second time. Is there something I need to know about os.putEnv? How do I permanently store an environment variable?
import os
var name = "name"
var value = "value"
echo "Currently: " & os.getEnv(name)
echo "Set " & name & " to " & value
os.putEnv(name, value)
echo "Got: " & os.getEnv(name)
> nim c -r repro.nim
...
Currently:
Set name to value
Got: value
> nim c -r repro.nim
...
Currently:
Set name to value
Got: value
btw, I get the same result when I replace every os with ospathsOn Windows, you can set an environment globally by modifying the registry: https://stackoverflow.com/questions/5246046/how-to-add-environment-variable-in-c
Don't expect os.putEnv to do that ... it's not portable, and not what people expect.