diff --git a/src/scripts/demos/simple_000.lua b/src/scripts/demos/simple_000.lua index 8b47718..9b8cedf 100644 --- a/src/scripts/demos/simple_000.lua +++ b/src/scripts/demos/simple_000.lua @@ -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) diff --git a/src/system/src/path.cpp b/src/system/src/path.cpp index bbeca09..2e186c1 100644 --- a/src/system/src/path.cpp +++ b/src/system/src/path.cpp @@ -12,7 +12,7 @@ #include #endif // #include "_host/helpers_osx.h" -#elif defined(TP_HAVE_UNISTD_H) +#elif defined(__USE_POSIX) #include #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 buf(MAXPATHLEN); + readlink("/proc/self/exe", buf.data(), buf.size()); + result.assign(buf.data()); #endif return result; }