32 #define WIN32_LEAN_AND_MEAN
34 #endif // OSVR_WINDOWS
37 #include <mach-o/dyld.h>
40 #include <boost/filesystem.hpp>
48 namespace fs = boost::filesystem;
50 static inline std::string getCanonicalGenericString(
const char path[]) {
51 return fs::canonical(path).generic_string();
54 #if defined(OSVR_WINDOWS)
57 DWORD len = GetModuleFileNameA(
nullptr, buf,
sizeof(buf));
64 #elif defined(OSVR_LINUX) || defined(OSVR_ANDROID)
66 return getCanonicalGenericString(
"/proc/self/exe");
68 #elif defined(OSVR_NETBSD)
70 return getCanonicalGenericString(
"/proc/curproc/exe");
72 #elif defined(OSVR_FREEBSD)
74 if (fs::exists(
"proc/curproc/file")) {
75 return getCanonicalGenericString(
"/proc/curproc/file");
80 #elif defined(OSVR_MACOSX)
83 uint32_t len =
sizeof(buf);
84 if (0 == _NSGetExecutablePath(buf, &len)) {
85 return getCanonicalGenericString(buf);
90 #error "getBinaryLocation() not yet implemented for this platform!"
std::string getBinaryLocation()