Function executableExtensions

Default executable extensions for the current system. 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.

Prototype

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

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);
}

Authors

Roman Chistokhodov

Copyright

Roman Chistokhodov 2016

License

Boost License 1.0.