mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
(Windows) Fixed two MSVC compiler warnings.
This commit is contained in:
parent
f35e3c2e65
commit
d041bda5cf
|
@ -247,7 +247,8 @@ void emergencyShutdown()
|
|||
void touch(const std::string& filename)
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
FILE* fp = fopen(filename.c_str(), "ab+");
|
||||
FILE* fp;
|
||||
fopen_s(&fp, filename.c_str(), "ab+");
|
||||
if (fp != nullptr)
|
||||
fclose(fp);
|
||||
#else
|
||||
|
|
|
@ -147,17 +147,21 @@ namespace Utils
|
|||
#if defined(_WIN64)
|
||||
// On Windows we need to check HOMEDRIVE and HOMEPATH.
|
||||
if (!homePath.length()) {
|
||||
#if defined(_WIN64)
|
||||
std::string envHomeDrive =
|
||||
Utils::String::wideStringToString(_wgetenv(L"HOMEDRIVE"));
|
||||
std::string envHomePath =
|
||||
Utils::String::wideStringToString(_wgetenv(L"HOMEPATH"));
|
||||
std::wstring envHomeDrive;
|
||||
std::wstring envHomePath;
|
||||
#if defined(_MSC_VER) // MSVC compiler.
|
||||
wchar_t* buffer;
|
||||
if (!_wdupenv_s(&buffer, nullptr, L"HOMEDRIVE"))
|
||||
envHomeDrive = buffer;
|
||||
if (!_wdupenv_s(&buffer, nullptr, L"HOMEPATH"))
|
||||
envHomePath = buffer;
|
||||
#else
|
||||
std::string envHomeDrive = getenv("HOMEDRIVE");
|
||||
std::string envHomePath = getenv("HOMEPATH");
|
||||
envHomeDrive = _wgetenv(L"HOMEDRIVE");
|
||||
envHomePath = _wgetenv(L"HOMEPATH");
|
||||
#endif
|
||||
if (envHomeDrive.length() && envHomePath.length())
|
||||
homePath = getGenericPath(envHomeDrive + "/" + envHomePath);
|
||||
homePath = getGenericPath(Utils::String::wideStringToString(envHomeDrive) +
|
||||
"/" + Utils::String::wideStringToString(envHomePath));
|
||||
}
|
||||
#else
|
||||
// Check for HOME environment variable.
|
||||
|
|
Loading…
Reference in a new issue