fix for Linux
This commit is contained in:
parent
40e8c43e01
commit
a5cdf4e5f9
2 changed files with 7 additions and 7 deletions
|
@ -31,6 +31,7 @@ w.on_update = function(self)
|
|||
|
||||
end
|
||||
|
||||
-- show all displays
|
||||
local ds = pw.display:all()
|
||||
for i = 1,#ds do
|
||||
print("display ",i,ds[i].name)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <mach/mach.h>
|
||||
#endif
|
||||
// #include "_host/helpers_osx.h"
|
||||
#elif defined(TP_HAVE_UNISTD_H)
|
||||
#elif defined(__USE_POSIX)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
// Unknown platform
|
||||
|
@ -57,9 +57,6 @@ std::string path::executable_path()
|
|||
{
|
||||
std::string result;
|
||||
|
||||
const unsigned int MAXPATHLEN = 2048;
|
||||
static char path[MAXPATHLEN];
|
||||
memset(&path[0],0,MAXPATHLEN);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
CFURLRef bundleURL;
|
||||
|
@ -79,9 +76,11 @@ std::string path::executable_path()
|
|||
static TCHAR lpFname[MAXPATHLEN];
|
||||
DWORD ret = GetModuleFileName( NULL, &lpFname[0], MAXPATHLEN );
|
||||
result.assign(&lpFname[0]);
|
||||
#else
|
||||
readlink("/proc/self/exe", path, sizeof(path));
|
||||
result.assign(path);
|
||||
#elif defined(__USE_POSIX)
|
||||
const size_t MAXPATHLEN = 2048;
|
||||
std::vector<char> buf(MAXPATHLEN);
|
||||
readlink("/proc/self/exe", buf.data(), buf.size());
|
||||
result.assign(buf.data());
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue