bool FileIsDirOnDisk(OovStringRef const path, OovStatus &status) { struct OovStat32 statval; int statRet = OovStat32(path, &statval); // Indicate there is an error only if the error is not ENOENT. status.set((statRet == 0) || (errno == ENOENT), SC_File); // Only indicate the directory exists if there was no error, and it is a directory. return((statRet == 0) && S_ISDIR(statval.st_mode)); }
bool FileIsFileOnDisk(OovStringRef const path, OovStatus &status) { OovString tempPath = path; FilePathRemovePathSep(tempPath, tempPath.size()-1); struct OovStat32 statval; int statRet = OovStat32(tempPath.getStr(), &statval); // Indicate there is an error only if the error is not ENOENT. status.set((statRet == 0) || (errno == ENOENT), SC_File); // Only indicate the file exists if there was no error, and it is a file. return((statRet == 0) && !S_ISDIR(statval.st_mode)); }