Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Matt Groening on October 10, 2008, 02:04:57 PM
-
Hello.
I want create folders and files in Application Data.
I want use environment variables (%APPDATA%) for it.
How I can make it?
-
There's no native support. You could get an environment variable by calling Windows API function using the "extern" function in WME script.
-
Mnemonic - can you give an example for how to write the proper extern call to get an environment variable ?
-
There is an exampleof the use. This case is for get a cnvironment variable.
// declaration
external "kernel32.dll" long GetEnvironmentVariable(string lpName , string lpBuffer , long nSize) ;
// use
var variable_name = "MY_VAR";
var variable_value = new String(255); // This var is passed by reference, the value of the environment variable is stored here
var value_lenght = 255;
GetEnvironmentVariable (variable_name, variable_value, value_length);