mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15: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)
|
void touch(const std::string& filename)
|
||||||
{
|
{
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
FILE* fp = fopen(filename.c_str(), "ab+");
|
FILE* fp;
|
||||||
|
fopen_s(&fp, filename.c_str(), "ab+");
|
||||||
if (fp != nullptr)
|
if (fp != nullptr)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -147,17 +147,21 @@ namespace Utils
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
// On Windows we need to check HOMEDRIVE and HOMEPATH.
|
// On Windows we need to check HOMEDRIVE and HOMEPATH.
|
||||||
if (!homePath.length()) {
|
if (!homePath.length()) {
|
||||||
#if defined(_WIN64)
|
std::wstring envHomeDrive;
|
||||||
std::string envHomeDrive =
|
std::wstring envHomePath;
|
||||||
Utils::String::wideStringToString(_wgetenv(L"HOMEDRIVE"));
|
#if defined(_MSC_VER) // MSVC compiler.
|
||||||
std::string envHomePath =
|
wchar_t* buffer;
|
||||||
Utils::String::wideStringToString(_wgetenv(L"HOMEPATH"));
|
if (!_wdupenv_s(&buffer, nullptr, L"HOMEDRIVE"))
|
||||||
|
envHomeDrive = buffer;
|
||||||
|
if (!_wdupenv_s(&buffer, nullptr, L"HOMEPATH"))
|
||||||
|
envHomePath = buffer;
|
||||||
#else
|
#else
|
||||||
std::string envHomeDrive = getenv("HOMEDRIVE");
|
envHomeDrive = _wgetenv(L"HOMEDRIVE");
|
||||||
std::string envHomePath = getenv("HOMEPATH");
|
envHomePath = _wgetenv(L"HOMEPATH");
|
||||||
#endif
|
#endif
|
||||||
if (envHomeDrive.length() && envHomePath.length())
|
if (envHomeDrive.length() && envHomePath.length())
|
||||||
homePath = getGenericPath(envHomeDrive + "/" + envHomePath);
|
homePath = getGenericPath(Utils::String::wideStringToString(envHomeDrive) +
|
||||||
|
"/" + Utils::String::wideStringToString(envHomePath));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Check for HOME environment variable.
|
// Check for HOME environment variable.
|
||||||
|
|
Loading…
Reference in a new issue