| 775 | } |
| 776 | |
| 777 | bool fsCheckPath(ResourceDirectory rd, const char* path, bool* exist, bool* isDir, bool* isFile) |
| 778 | { |
| 779 | const char* resourcePath = fsGetResourceDirectory(rd); |
| 780 | char fullPath[FS_MAX_PATH] = { 0 }; |
| 781 | fsAppendPathComponent(resourcePath, path, fullPath); |
| 782 | |
| 783 | // 'lstat' won't resolve symlink entries, so we use 'stat'. |
| 784 | // We are only interested in entry targeted by symlink |
| 785 | struct stat st = { 0 }; |
| 786 | if (stat(fullPath, &st) == 0) |
| 787 | { |
| 788 | *exist = true; |
| 789 | *isDir = S_ISDIR(st.st_mode); |
| 790 | *isFile = S_ISREG(st.st_mode); |
| 791 | return true; |
| 792 | } |
| 793 | |
| 794 | *exist = false; |
| 795 | *isDir = false; |
| 796 | *isFile = false; |
| 797 | |
| 798 | if (errno == ENOENT) |
| 799 | return true; |
| 800 | |
| 801 | LOGF(eERROR, "Failed to retreive path '%s' info: '%'", fullPath, strerror(errno)); |
| 802 | return false; |
| 803 | } |
| 804 | |
| 805 | bool fsDirectoryIteratorOpen(ResourceDirectory rd, const char* dir, FsDirectoryIterator* out) |
| 806 | { |
no test coverage detected