Manages launching and terminating VPX processes. More...
#include <process_handler.h>
Public Member Functions | |
ProcessHandler (const std::string &exeDir, IConfigService *configManager) | |
Constructs a ProcessHandler instance. | |
bool | launchVPX (const std::string &vpxFile) |
Launches a VPX process. | |
void | terminateVPX () |
Terminates the running VPX process. | |
std::string | shellEscape (const std::string &str) |
Escapes a string for safe shell usage. | |
Manages launching and terminating VPX processes.
This class handles the execution of VPX files (e.g., for screenshot mode or gameplay), tracking the process ID and terminating the process when needed. It integrates with IConfigService for settings and uses the executable directory for path resolution.
ProcessHandler::ProcessHandler | ( | const std::string & | exeDir, |
IConfigService * | configManager | ||
) |
Constructs a ProcessHandler instance.
Initializes the handler with the executable directory and configuration service.
exeDir | The executable directory for resolving file paths. |
configManager | The configuration service for settings. |
bool ProcessHandler::launchVPX | ( | const std::string & | vpxFile | ) |
Launches a VPX process.
Starts a VPX process for the specified VPX file.
vpxFile | The path to the VPX file to launch. |
std::string ProcessHandler::shellEscape | ( | const std::string & | str | ) |
Escapes a string for safe shell usage.
Escapes special characters in the string to prevent shell injection.
str | The input string to escape. |
void ProcessHandler::terminateVPX | ( | ) |
Terminates the running VPX process.
Stops the VPX process if it is running.