fix for Linux

This commit is contained in:
Hartmut Seichter 2019-02-06 13:13:29 +01:00
parent 40e8c43e01
commit a5cdf4e5f9
2 changed files with 7 additions and 7 deletions

View file

@ -31,6 +31,7 @@ w.on_update = function(self)
end end
-- show all displays
local ds = pw.display:all() local ds = pw.display:all()
for i = 1,#ds do for i = 1,#ds do
print("display ",i,ds[i].name) print("display ",i,ds[i].name)

View file

@ -12,7 +12,7 @@
#include <mach/mach.h> #include <mach/mach.h>
#endif #endif
// #include "_host/helpers_osx.h" // #include "_host/helpers_osx.h"
#elif defined(TP_HAVE_UNISTD_H) #elif defined(__USE_POSIX)
#include <unistd.h> #include <unistd.h>
#else #else
// Unknown platform // Unknown platform
@ -57,9 +57,6 @@ std::string path::executable_path()
{ {
std::string result; std::string result;
const unsigned int MAXPATHLEN = 2048;
static char path[MAXPATHLEN];
memset(&path[0],0,MAXPATHLEN);
#if defined(__APPLE__) #if defined(__APPLE__)
CFURLRef bundleURL; CFURLRef bundleURL;
@ -79,9 +76,11 @@ std::string path::executable_path()
static TCHAR lpFname[MAXPATHLEN]; static TCHAR lpFname[MAXPATHLEN];
DWORD ret = GetModuleFileName( NULL, &lpFname[0], MAXPATHLEN ); DWORD ret = GetModuleFileName( NULL, &lpFname[0], MAXPATHLEN );
result.assign(&lpFname[0]); result.assign(&lpFname[0]);
#else #elif defined(__USE_POSIX)
readlink("/proc/self/exe", path, sizeof(path)); const size_t MAXPATHLEN = 2048;
result.assign(path); std::vector<char> buf(MAXPATHLEN);
readlink("/proc/self/exe", buf.data(), buf.size());
result.assign(buf.data());
#endif #endif
return result; return result;
} }