Skip to content

Commit

Permalink
Installer: Fix identifying existing paths as non-existant
Browse files Browse the repository at this point in the history
  • Loading branch information
IntriguingTiles committed Mar 19, 2023
1 parent f985517 commit 171cdf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Installer/Installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ std::wstring LocateHalfLifeFromRegistry() {

BOOL FileExists(const wchar_t* path) {
DWORD attribs = GetFileAttributes(path);
return attribs != INVALID_FILE_ATTRIBUTES && attribs != FILE_ATTRIBUTE_DIRECTORY;
return attribs != INVALID_FILE_ATTRIBUTES && ((attribs & FILE_ATTRIBUTE_DIRECTORY) == 0);
}

BOOL DirExists(const wchar_t* path) {
DWORD attribs = GetFileAttributes(path);
return attribs != INVALID_FILE_ATTRIBUTES && attribs == FILE_ATTRIBUTE_DIRECTORY;
return attribs != INVALID_FILE_ATTRIBUTES && attribs & FILE_ATTRIBUTE_DIRECTORY;
}

int FindInArray(BYTE* arr, int length, const char* sig, int siglen) {
Expand Down

0 comments on commit 171cdf8

Please sign in to comment.