-----------------------------------------------------------------------------
| 1009 | |
| 1010 | //----------------------------------------------------------------------------- |
| 1011 | S32 Platform::getFileSize(const char *pFilePath) |
| 1012 | { |
| 1013 | if (!pFilePath || !*pFilePath) |
| 1014 | return -1; |
| 1015 | // Get the file info |
| 1016 | struct stat fStat; |
| 1017 | if (stat(pFilePath, &fStat) < 0) |
| 1018 | return -1; |
| 1019 | // if the file is a "regular file" then return the size |
| 1020 | if ( (fStat.st_mode & S_IFMT) == S_IFREG) |
| 1021 | return fStat.st_size; |
| 1022 | // Must be something else or we can't read the file. |
| 1023 | return -1; |
| 1024 | } |
| 1025 | |
| 1026 | //----------------------------------------------------------------------------- |
| 1027 | bool Platform::isDirectory(const char *pDirPath) |