mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[util] Added missing files
This commit is contained in:
parent
56826cbf82
commit
4a4f5bea29
22
src/util/util_env.cpp
Normal file
22
src/util/util_env.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "util_env.h"
|
||||
|
||||
#include "./com/com_include.h"
|
||||
|
||||
namespace dxvk::env {
|
||||
|
||||
std::string getEnvVar(const wchar_t* name) {
|
||||
DWORD len = ::GetEnvironmentVariableW(name, nullptr, 0);
|
||||
|
||||
std::wstring result;
|
||||
|
||||
while (len > result.size()) {
|
||||
result.resize(len);
|
||||
len = ::GetEnvironmentVariableW(
|
||||
name, result.data(), result.size());
|
||||
}
|
||||
|
||||
result.resize(len);
|
||||
return str::fromws(result);
|
||||
}
|
||||
|
||||
}
|
18
src/util/util_env.h
Normal file
18
src/util/util_env.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "util_string.h"
|
||||
|
||||
namespace dxvk::env {
|
||||
|
||||
/**
|
||||
* \brief Gets environment variable
|
||||
*
|
||||
* If the variable is not defined, this will return
|
||||
* an empty string. Note that environment variables
|
||||
* may be defined with an empty value.
|
||||
* \param [in] name Name of the variable
|
||||
* \returns Value of the variable
|
||||
*/
|
||||
std::string getEnvVar(const wchar_t* name);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user