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:
parent
c2c10cc207
commit
cea1f15eab
@ -1,4 +1,5 @@
|
|||||||
#include "util_env.h"
|
#include "util_env.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "./com/com_include.h"
|
#include "./com/com_include.h"
|
||||||
|
|
||||||
@ -7,12 +8,12 @@ namespace dxvk::env {
|
|||||||
std::string getEnvVar(const wchar_t* name) {
|
std::string getEnvVar(const wchar_t* name) {
|
||||||
DWORD len = ::GetEnvironmentVariableW(name, nullptr, 0);
|
DWORD len = ::GetEnvironmentVariableW(name, nullptr, 0);
|
||||||
|
|
||||||
std::wstring result;
|
std::vector<WCHAR> result;
|
||||||
|
|
||||||
while (len > result.size()) {
|
while (len > result.size()) {
|
||||||
result.resize(len);
|
result.resize(len);
|
||||||
len = ::GetEnvironmentVariableW(
|
len = ::GetEnvironmentVariableW(
|
||||||
name, &result.at(0), result.size());
|
name, result.data(), result.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
result.resize(len);
|
result.resize(len);
|
||||||
@ -21,10 +22,10 @@ namespace dxvk::env {
|
|||||||
|
|
||||||
|
|
||||||
std::string getExeName() {
|
std::string getExeName() {
|
||||||
std::wstring exePath;
|
std::vector<WCHAR> exePath;
|
||||||
exePath.resize(MAX_PATH + 1);
|
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);
|
exePath.resize(len);
|
||||||
|
|
||||||
std::string fullPath = str::fromws(exePath.data());
|
std::string fullPath = str::fromws(exePath.data());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user