| 1149 | } |
| 1150 | |
| 1151 | bool IsImageFile(Path& image) { |
| 1152 | static const char* ending_arr[] = { |
| 1153 | ".png", |
| 1154 | ".dds", |
| 1155 | ".crn", |
| 1156 | ".jpg", |
| 1157 | ".jpeg", |
| 1158 | ".PNG", |
| 1159 | ".JPG", |
| 1160 | ".JPEG", |
| 1161 | ".DDS", |
| 1162 | ".CRN", |
| 1163 | NULL}; |
| 1164 | |
| 1165 | bool has_match = false; |
| 1166 | const char* str = image.GetOriginalPath(); |
| 1167 | unsigned c = 0; |
| 1168 | while (ending_arr[c] != NULL) { |
| 1169 | if (endswith(str, ending_arr[c])) { |
| 1170 | has_match = true; |
| 1171 | break; |
| 1172 | } |
| 1173 | c++; |
| 1174 | } |
| 1175 | |
| 1176 | return has_match && IsFile(image); |
| 1177 | } |
| 1178 | |
| 1179 | string SanitizePath(const string& path) { |
| 1180 | return SanitizePath(path.c_str()); |
no test coverage detected