![]() |
CARTA Backend
The backend component of CARTA
|
#include "App.h"#include <unistd.h>#include <climits>#include <fstream>#include <sstream>#include "FileSystem.h"#include "Logger/Logger.h"Macros | |
| #define | MAX_PLATFORM_INFO_LENGTH 1024 |
| #define | MAX_PLATFORM_LINE_LENGTH 256 |
Functions | |
| bool | FindExecutablePath (std::string &path) |
| Retrieves the absolute path of the currently running executable. | |
| std::string | GetReleaseInformation () |
| Retrieves the operating system release information. | |
| std::string | OutputOfCommand (const char *command) |
| Executes a shell command and returns its output. | |
| #define MAX_PLATFORM_INFO_LENGTH 1024 |
| #define MAX_PLATFORM_LINE_LENGTH 256 |
| bool FindExecutablePath | ( | std::string & | path | ) |
Retrieves the absolute path of the currently running executable.
This function determines the full path of the running executable and stores it in the path parameter. It supports both macOS (_NSGetExecutablePath) and Linux (/proc/self/exe).
_NSGetExecutablePath is used, and the buffer size is checked dynamically. /proc/self/exe using readlink()._NSGetExecutablePath may fail, this implementation does not handle resizing the buffer. | std::string GetReleaseInformation | ( | ) |
Retrieves the operating system release information.
This function fetches OS release details using platform-specific methods:
sw_vers command and reads the output./etc/os-release, which is available on most distributions using systemd.popen("sw_vers", "r") is used to execute sw_vers, which outputs OS version details./etc/os-release file into a string.spdlog::warn.| std::string OutputOfCommand | ( | const char * | command | ) |
Executes a shell command and returns its output.
This function opens a pipe using popen() to execute the given command, reads its output, and returns it as a std::string.
popen() fails, an error message is printed, and an empty string is returned.popen() fails.