Sys.getCwd returns empty string while targeting CPP

Hello,
I’m on a project in which I need to get the user’s current working directory. I tried:

  • sys.FileSystem.absolutePath(".")
  • Sys.programPath() / Sys.executablePath()
  • Sys.getCwd()
public static function main() {
	trace(Sys.getCwd());
}

I tried with a little project with just a Main.hx and this code snippet is getting well in haxe but not in CPP. In CPP, it returns an empty string.

After some research in forums, I found a “solution” using macros but this one keep the cwd at compilation. This is not what we intend because the program needs to access distributed resources.

public static function main() {
	trace(cwd());
}
	
public static macro function cwd():haxe.macro.Expr.ExprOf<String> {
	return macro $v{Sys.getCwd()};
}

If you have any solutions to make Sys.getCwd() work in CPP.

Thanks

trace(Sys.getCwd()); correctly print the cwd for me.

Which version of haxe and hxcpp do you have?
What is your OS?
Does the cwd contains a special/non ascii character?

I use haxe 4.0.0-rc.2+77068e10c, hxcpp 4.0.8
My OS is Windows.
The cwd does not contains special/non ascii characters but it could have some with our clients.