Environment variable support
Copy link to clipboard
Copied
Hey there. I'm wondering if there's support (albeit undocumented) for environment variables (like %WINDIR%, for example). From previous forum threads it appears support wasn't there previously but I'm really hoping things have changed.
Specifically, here's what I'm trying to accomplish:
var info:NativeProcessStartupInfo = new NativeProcessStartupInfo();
info.executable = File.applicationDirectory.resolvePath(whereisPath);
info.workingDirectory = File.applicationDirectory;
var args:Vector.<String> = new Vector.<String>();
args.push('-r');
args.push('%WINDIR%\\SysWOW64;%WINDIR%\\System32'); // searches in the Windows system paths
args.push('-s'); // succinct output. Prints path only
args.push(exeToFind);
info.arguments = args;
nativeProcess = new NativeProcess();
addListeners();
nativeProcess.start(info);
When I run the executable with the same arguments in CMD, %WINDIR% is correctly interpreted. However, when run from AIR, it appears that %WINDIR% is never translated.
Thanks for any info...even if it turns out it's just not supported.
Aaron

Copy link to clipboard
Copied
I'd like to echo this one: even running cmd.exe requires WINDIR - I'd love to know how to access it via envvar or constant or something.
Copy link to clipboard
Copied
Unfortunately we don't have support for this yet. There is a feature request for this on our ideas.adobe.com site that I'd like to encourage you guys to vote for. The only workaround that I know of at this point is to create a separate helper application that can query the environment variables using a native api (e.g. GetEnvironmentVariable()), then pass those back to your AIR app and use them for your target native process.
Chris
