How to access environment variables in Vala?

How do I access environment variables in Vala? (as stated above) seems simple, but I cannot find how g_getenv () is displayed in Vala.

+6
environment-variables vala
source share
1 answer

The answer lies in the bindings file. Vala uses bindings (in .vapi files) to bind its constructs to C. In this case, you can grep via glib-2.0.vapi (on my system, which is located in /usr/share/vala-0.10/vapi ), and You will see that it is connected as:

 unowned string? GLib.Environment.get_variable(string name) 

It can be very useful to have the location of the main VAPI files, because if you know the C name of the function, you can just grep for it.

+10
source share

All Articles