Skip to content

Commit

Permalink
FileUtil: handle some error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffle2 committed Aug 23, 2020
1 parent 3bc8a26 commit 49590c9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Source/Core/Common/FileUtil.cpp
Expand Up @@ -600,7 +600,7 @@ std::string GetCurrentDir()
if (!dir)
{
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LastStrerrorString().c_str());
return nullptr;
return "";
}
std::string strDir = dir;
free(dir);
Expand All @@ -621,10 +621,15 @@ std::string CreateTempDir()
return "";

GUID guid;
CoCreateGuid(&guid);
TCHAR tguid[40];
StringFromGUID2(guid, tguid, 39);
tguid[39] = 0;
if (FAILED(CoCreateGuid(&guid)))
{
return "";
}
OLECHAR tguid[40]{};
if (!StringFromGUID2(guid, tguid, _countof(tguid)))
{
return "";
}
std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid);
if (!CreateDir(dir))
return "";
Expand Down

0 comments on commit 49590c9

Please sign in to comment.