"qat-{pid}.txt" file not created when environment variable TEMP is not defined on Linux

Description of Issue

When attaching to an application on Linux, the server creates "qat-{pid}.txt". If the environment variable TEMP is not defined, the file is created in the working directory.

In the python code, qat_environement.get_temp_folder(), it's expected to be under /tmp (value returned by tempfile.gettempdir())

Affected version(s)

all Linux versions up to 1.1.2.

MacOs versions are potentially impacted as well (not tested).

System information

  • OS: Linux
  • Kernel Version: 6.9.3-76060903-generic
  • OS version: Pop!_OS 22.04 LTS (64 bit)
  • Qt version: 6.2
  • Python version: 3.10.12

Steps to reproduce

  1. Manually launch QmlApp
  2. Run the following code (once the bug #24 is fixed) :
import qat
qat.attach_to_application("QmlApp")

What is the current issue behavior?

In Launcher.cc, std::string GetTempPath() return an empty string when TEMP is not defined

What is the expected expected behavior?

Qat is able to find the file "qat-{pid}.txt".

Relevant logs and/or screenshots

N/A

Possible fixes

  1. In Launcher.cc, std::string GetTempPath() should return the default /tmp folder (for exemple by returning std::filesystem::temp_directory_path();)
  2. Or update qat_environement.get_temp_folder() to return empty string when TEMP is not defined
Edited by Kevin DA SILVA