diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-14 09:28:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-14 09:28:42 +0200 |
commit | 1ebfd95dce50db4fa9523a26aba1f80e4ff5db52 (patch) | |
tree | 00732314f4845bbd1320a227087a7ee9d03d428f | |
parent | 413e6fef09190b0ddc1a110415d964f88f332655 (diff) |
fix Linux game detection code
Issue: #181
-rwxr-xr-x | CMakeLists.txt | 15 | ||||
-rwxr-xr-x | opentrack-compat/process-list.hpp | 10 |
2 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 18e2a9cd..54fbfed5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,11 @@ IF(WIN32) SET(SDK_CONSOLE_DEBUG FALSE CACHE BOOL "Console window visible at runtime") ENDIF() -IF("${CMAKE_SYSTEM}" MATCHES "Linux" OR APPLE) +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(LINUX TRUE) +endif() + +if(LINUX OR APPLE) set(SDK_XPLANE "" CACHE PATH "Path to X-Plane SDK") set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support") endif() @@ -505,15 +509,16 @@ endif() link_with_dinput8(opentrack) target_link_libraries(opentrack ${MY_QT_LIBS}) -if(CMAKE_SYSTEM STREQUAL LINUX) - link_libraries(rt) -endif() - if(APPLE) # for process detector target_link_libraries(opentrack proc) endif() +if(LINUX) + # for process detector + target_link_libraries(opentrack procps) +endif() + # ---- # make install diff --git a/opentrack-compat/process-list.hpp b/opentrack-compat/process-list.hpp index f3388c4f..6b139739 100755 --- a/opentrack-compat/process-list.hpp +++ b/opentrack-compat/process-list.hpp @@ -124,7 +124,6 @@ static QStringList get_all_executable_names() #elif defined __linux -// link to procps #include <proc/readproc.h> #include <cerrno> template<typename = void> @@ -139,10 +138,13 @@ static QStringList get_all_executable_names() } for (int i = 0; procs[i]; i++) { - auto& proc = *procs[i]; - ret.append(proc.cmd); + // note, wine sets argv[0] so no parsing like in OSX case + auto proc = procs[i]; + if (proc->cmdline && proc->cmdline[0]) + ret.append(proc->cmdline[0]); + freeproc(procs[i]); } - freeproctab(procs); + free(procs); return ret; } |