Haxe: get path to the `std` library

I need to get path to the std folder of Haxe. On Linux system it can be /usr/share/haxe/std, on Windows -- C:\HaxeToolkit\haxe\std\.

There are haxelib config, haxelib path and haxelib libpath commands, but they point me to /usr/local/lib/haxe/ folder.

How can I get this path in my script?

I tried these commands haxelib config, haxelib path, haxelib libpath but they help me only on Windows, because on Windows std and lib foldrs are in the same folder.


  • There's a way to do this with Haxe:


    class ResolveStd {
        static macro function getStdPath() {
            var evalDir = haxe.macro.Context.resolvePath("eval");
            var stdDir = haxe.io.Path.directory(evalDir);
            return macro $v{stdDir};
        public static function main() {

    and then

    haxe --run ResolveStd.hx

    will have output like


    (explanation: we're asking the compiler to resolve path of eval, which is one of the subdirectories in std, then going one level up)