This function has limited platform support, and using it can lead to unnecessary failures and race conditions. It is generally advisable to avoid this function entirely.
Oh, I see. It worked if I opened the directory with openDir, but not with cwd(), I guess it is in fact special. And actually I did endup using currentPath method in my project.
Any suggestions on how I would get the path of the directory if I will need to in the future, since realPath is not advised to use? Outside of calculating it myself.
Honestly that’s about it. IIRC Andrew discovered how cursed getting the “real path” can be for any cross platform library. It’s going to generally be best to try and avoid needing to get it, or calling the system API directly and understanding all it’s documented caveats.
Unless you really, really need to, just don’t work with paths. Work with file descriptors/handles instead (std.Io.File and std.Io.Dir are just thin wrappers around those, so use that), they give you everything you need without the caveats hiding behind working with paths. Only use paths when provided from the outside of your program and even then just immediately open them to get a file descriptor.