Skip to content

Commit

Permalink
Tweak FileExists to account for empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Jun 20, 2024
1 parent 4b38c85 commit 8d12944
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/lib_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool MakeDirectory(std::string_view dir)
}
bool FileExists(std::string_view name)
{
SYS_ASSERT(!name.empty());
if (name.empty()) return false;
std::wstring wname = UTF8ToWString(name);
return _waccess(wname.c_str(), 0) == 0;
}
Expand Down Expand Up @@ -157,7 +157,7 @@ bool MakeDirectory(std::string_view dir)
}
bool FileExists(std::string_view name)
{
SYS_ASSERT(!name.empty());
if (name.empty()) return false;
return access(std::string(name).c_str(), F_OK) == 0;
}
#endif
Expand Down

0 comments on commit 8d12944

Please sign in to comment.