How do I access environment variables in Vala? (as above) it seems simple, but I can't find how g_getenv() is mapped into Vala.
On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables.
To list all the environment variables, use the command " env " (or " printenv "). You could also use " set " to list all the variables, including all local variables.
On Windows In the command window that opens, enter echo %VARIABLE%. Replace VARIABLE with the name of the environment variable you set earlier. For example, to check if MARI_CACHE is set, enter echo %MARI_CACHE%. If the variable is set, its value is displayed in the command window.
The most used command to displays the environment variables is printenv . If the name of the variable is passed as an argument to the command, only the value of that variable is displayed. If no argument is specified, printenv prints a list of all environment variables, one variable per line.
The answer lies in the bindings file. Vala uses bindings (in .vapi files) for binding its constructs to the C language. In this case you can grep through glib-2.0.vapi (on my system that is in /usr/share/vala-0.10/vapi
), and you'll see that it is bound as:
unowned string? GLib.Environment.get_variable(string name)
It can be quite useful to have the location of the core VAPI files handy, because if you know the C name of a function you can just grep for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With