环境变量管理类
更多...
#include <environment.hpp>
|
|
static constexpr char | delimiter |
| | 路径分隔符
|
环境变量管理类
提供静态方法用于访问和修改环境变量,所有操作都是线程安全的。
在文件 environment.hpp 第 28 行定义.
◆ add_to_path()
| bool neforce::environment::add_to_path |
( |
const string & | path, |
|
|
int | position = 1 ) |
|
static |
向PATH环境变量添加路径
- 参数
-
| path | 要添加的路径 |
| position | 添加位置(0:开头,其他:末尾) |
- 返回
- 是否添加成功
◆ all_envs()
◆ app_data_directory()
| string neforce::environment::app_data_directory |
( |
| ) |
|
|
staticnodiscard |
◆ config_directory()
| string neforce::environment::config_directory |
( |
| ) |
|
|
staticnodiscard |
◆ current_directory()
| string neforce::environment::current_directory |
( |
| ) |
|
|
staticnodiscard |
◆ current_user()
| string neforce::environment::current_user |
( |
| ) |
|
|
staticnodiscard |
◆ exists()
| bool neforce::environment::exists |
( |
const string & | name | ) |
|
|
staticnodiscard |
◆ get()
获取环境变量值
- 参数
-
- 返回
- 环境变量值,不存在返回空字符串
◆ home_directory()
| string neforce::environment::home_directory |
( |
| ) |
|
|
staticnodiscard |
◆ path_list()
◆ set()
| bool neforce::environment::set |
( |
const string & | name, |
|
|
const string & | value, |
|
|
bool | overwrite = true ) |
|
static |
设置环境变量
- 参数
-
| name | 环境变量名 |
| value | 环境变量值 |
| overwrite | 是否覆盖已有值 |
- 返回
- 是否设置成功
◆ temp_directory()
| string neforce::environment::temp_directory |
( |
| ) |
|
|
staticnodiscard |
◆ unset()
| bool neforce::environment::unset |
( |
const string & | name | ) |
|
|
static |
该类的文档由以下文件生成: