1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[util] Don't use std::wstring.

std::wstring is problematic, because wchar_t on other platforms might not be what we need. -fshort-wchar can mitigate that partially, but it's more problematic for stdc++ classes.
This commit is contained in:
Jacek Caban 2018-07-18 02:01:24 +02:00 committed by Philip Rebohle
parent c2c10cc207
commit cea1f15eab

View File

@ -1,4 +1,5 @@
#include "util_env.h"
#include <vector>
#include "./com/com_include.h"
@ -7,12 +8,12 @@ namespace dxvk::env {
std::string getEnvVar(const wchar_t* name) {
DWORD len = ::GetEnvironmentVariableW(name, nullptr, 0);
std::wstring result;
std::vector<WCHAR> result;
while (len > result.size()) {
result.resize(len);
len = ::GetEnvironmentVariableW(
name, &result.at(0), result.size());
name, result.data(), result.size());
}
result.resize(len);
@ -21,10 +22,10 @@ namespace dxvk::env {
std::string getExeName() {
std::wstring exePath;
std::vector<WCHAR> exePath;
exePath.resize(MAX_PATH + 1);
DWORD len = ::GetModuleFileNameW(NULL, &exePath.at(0), MAX_PATH);
DWORD len = ::GetModuleFileNameW(NULL, exePath.data(), MAX_PATH);
exePath.resize(len);
std::string fullPath = str::fromws(exePath.data());