fixed file_exists and dir_exists

This commit is contained in:
2023-03-13 19:30:13 +06:00
parent 965c784e37
commit 0adea8c52c
2 changed files with 4 additions and 4 deletions

View File

@@ -12,13 +12,13 @@ bool dir_exists(const char* path){
#if KFS_USE_WINDOWS_H
DWORD dwAttrib = GetFileAttributes(path);
return (bool)(
(dwAttrib != INVALID_FILE_ATTRIBUTES) & // file exists
(dwAttrib != INVALID_FILE_ATTRIBUTES) && // file exists
(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); // file is a directory
#else
struct stat stats;
i32 rez=stat(path, &stats);
return (bool)(
(rez!=-1) & // file exists
(rez!=-1) && // file exists
(S_ISDIR(stats.st_mode))); // file is a directory
#endif
}