From 2890f24c97b6ee0027d11c78f5e44514180c6ecf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 31 Jan 2021 17:37:54 +0100 Subject: [PATCH] Implement getting process executable path. --- client/TracyProfiler.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 9ea3d12b..2f94eaef 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -278,6 +278,19 @@ static const char* GetProcessName() return processName; } +static const char* GetProcessExecutablePath() +{ +#ifdef _WIN32 + static char buf[_MAX_PATH]; + GetModuleFileNameA( nullptr, buf, _MAX_PATH ); + return buf; +#elif defined _GNU_SOURCE || defined __CYGWIN__ + return program_invocation_name; +#else + return nullptr; +#endif +} + #if defined __linux__ && defined __ARM_ARCH static uint32_t GetHex( char*& ptr, int skip ) {