[util] Added missing files

This commit is contained in:
Philip Rebohle 2017-12-08 11:18:23 +01:00
parent 56826cbf82
commit 4a4f5bea29
2 changed files with 40 additions and 0 deletions

22
src/util/util_env.cpp Normal file
View 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
View 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);
}