maint(main): no longer fail on missing env variable

This commit is contained in:
Edo 2023-03-25 11:03:56 +00:00 committed by GitHub
parent f05ca8407c
commit 75c8d9a1a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,11 +162,11 @@ void limit_parallel_dll_loading()
void apply_environment()
{
wchar_t* buffer{};
char* buffer{};
std::size_t size{};
if (_wdupenv_s(&buffer, &size, L"XLABS_AW_INSTALL") != 0 || buffer == nullptr)
if (_dupenv_s(&buffer, &size, "XLABS_AW_INSTALL") != 0 || buffer == nullptr)
{
throw std::runtime_error("Please use the X Labs launcher to run the game!");
return;
}
const auto _ = gsl::finally([&]
@ -174,8 +174,8 @@ void apply_environment()
std::free(buffer);
});
SetCurrentDirectoryW(buffer);
SetDllDirectoryW(buffer);
SetCurrentDirectoryA(buffer);
SetDllDirectoryA(buffer);
}
int main()