The function `std.file.thisExPath` depends upon the process filesystem being mounted, which isn't the case by default. However, NetBSD provides a sysctl to get the path name similar to FreeBSD, as can be sen in this C snippet: int mib[4] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME }; Documentation can be found at: https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-current It would be nice to alter the code to make use of this sysctl call instead.
I also noticed that DragonFlyBSD is using procfs too, but has the same sysctl as FreeBSD (though numbered differently of course...): https://man.dragonflybsd.org/?command=sysctl§ion=3
@euantorano created dlang/phobos pull request #7578 "Fix issue 21113: Use sysctl for thisExePath on BSD." fixing this issue: - Fix issue 21113: Use sysctl for thisExePath on BSD. https://github.com/dlang/phobos/pull/7578
dlang/phobos pull request #7578 "Fix issue 21113: Use sysctl for thisExePath on BSD." was merged into master: - c51853866e38def161c34b0d88e89808d77d3551 by Euan Torano: Fix issue 21113: Use sysctl for thisExePath on BSD. https://github.com/dlang/phobos/pull/7578