------------------------------------------------------------------------------------------------ Tests for the existence of a file at the given path.
| 93 | // ------------------------------------------------------------------------------------------------ |
| 94 | // Tests for the existence of a file at the given path. |
| 95 | bool DefaultIOSystem::Exists(const char *pFile) const { |
| 96 | if (pFile == nullptr) { |
| 97 | return false; |
| 98 | } |
| 99 | |
| 100 | #ifdef _WIN32 |
| 101 | struct __stat64 filestat; |
| 102 | if (_wstat64(Utf8ToWide(pFile).c_str(), &filestat) != 0) { |
| 103 | return false; |
| 104 | } |
| 105 | #else |
| 106 | struct stat statbuf; |
| 107 | if (stat(pFile, &statbuf) != 0) { |
| 108 | return false; |
| 109 | } |
| 110 | // test for a regular file |
| 111 | if (!S_ISREG(statbuf.st_mode)) { |
| 112 | return false; |
| 113 | } |
| 114 | #endif |
| 115 | |
| 116 | return true; |
| 117 | } |
| 118 | |
| 119 | // ------------------------------------------------------------------------------------------------ |
| 120 | // Open a new file with a given path. |
no test coverage detected