| 219 | //========================================================================== |
| 220 | |
| 221 | bool GetFileInfo(const char* pathname, size_t *size, time_t *time) |
| 222 | { |
| 223 | if (pathname == NULL || *pathname == 0) |
| 224 | return false; |
| 225 | |
| 226 | #ifndef _WIN32 |
| 227 | struct stat info; |
| 228 | bool res = stat(pathname, &info) == 0; |
| 229 | #else |
| 230 | // Windows must use the wide version of stat to preserve non-standard paths. |
| 231 | auto wstr = WideString(pathname); |
| 232 | struct _stat64 info; |
| 233 | bool res = _wstat64(wstr.c_str(), &info) == 0; |
| 234 | #endif |
| 235 | if (!res || (info.st_mode & S_IFDIR)) return false; |
| 236 | if (size) *size = (size_t)info.st_size; |
| 237 | if (time) *time = info.st_mtime; |
| 238 | return res; |
| 239 | } |
| 240 | |
| 241 | //========================================================================== |
| 242 | // |
no test coverage detected