libnick 2024.9.2
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
environment.h
Go to the documentation of this file.
1
23#ifndef ENVIRONMENT_H
24#define ENVIRONMENT_H
25
26#if (defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS))
27#define _CRT_SECURE_NO_WARNINGS
28#endif
29
30#include <filesystem>
31#include <string>
32#include <vector>
33#include "app/appinfo.h"
34#include "deploymentmode.h"
35#include "operatingsystem.h"
36
38{
44 {
45#ifdef _WIN32
47#elif defined(__linux__)
49#elif defined(__APPLE__)
51#else
53#endif
54 }
64 const std::filesystem::path& getExecutableDirectory();
69 std::string getLocaleName();
75 bool hasVariable(const std::string& key);
81 std::string getVariable(const std::string& key);
88 bool setVariable(const std::string& key, const std::string& value);
94 bool clearVariable(const std::string& key);
101 bool testVariable(const std::string& key);
106 std::vector<std::filesystem::path> getPath();
112 std::string exec(const std::string& cmd);
120 const std::filesystem::path& findDependency(std::string dependency);
127 std::string getDebugInformation(const App::AppInfo& appInfo, const std::string& extraInformation = "");
128}
129
130#endif //ENVIRONMENT_H
A model for the information about an application.
Definition appinfo.h:37
Definition environment.h:38
DeploymentMode getDeploymentMode()
Gets the current deployment mode.
std::string getLocaleName()
Gets the name of the current locale.
std::string exec(const std::string &cmd)
Executes a command in the system shell.
bool setVariable(const std::string &key, const std::string &value)
Sets the value of an environment variable.
std::vector< std::filesystem::path > getPath()
Gets a list of directories from the system PATH variable.
std::string getVariable(const std::string &key)
Gets the value of an environment variable.
const std::filesystem::path & getExecutableDirectory()
Gets the path of the executable's directory.
constexpr OperatingSystem getOperatingSystem()
Gets the current operating system.
Definition environment.h:43
const std::filesystem::path & findDependency(std::string dependency)
Finds the path of a given executable dependency in the system.
bool testVariable(const std::string &key)
Tests an environment variable value to see if it is true.
std::string getDebugInformation(const App::AppInfo &appInfo, const std::string &extraInformation="")
Gets a debug information string about the user's environment.
bool clearVariable(const std::string &key)
Clears an environment variable.
bool hasVariable(const std::string &key)
Checks if an environment variable exists.
DeploymentMode
Supported deployment modes.
Definition deploymentmode.h:32
OperatingSystem
Supported operating systems.
Definition operatingsystem.h:32
@ MacOS
The MacOS operating system.
@ Other
A unknown operating system.
@ Windows
The Windows operating system.
@ Linux
The Linux operating system.