Function executableExtensions

Default executable extensions for the current system.

auto string[] executableExtensions() pure nothrow @nogc @trusted;

On Windows this functions examines PATHEXT environment variable to get the list of executables extensions. Fallbacks to .exe;.com;.bat;.cmd if PATHEXT does not list .exe extension. On other systems it always returns empty range.

Note

This function does not cache its result

Example

version(Windows) {
    auto guard = EnvGuard("PATHEXT");
    environment["PATHEXT"] = ".exe;.bat;.cmd";
    assert(equal(executableExtensions(), [".exe", ".bat", ".cmd"]));
    environment["PATHEXT"] = "";
    assert(equal(executableExtensions(), defaultExts.splitter(pathVarSeparator)));
} else {
    assert(executableExtensions().empty);
}