MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / IsImageFile

Function IsImageFile

Source/Internal/filesystem.cpp:1151–1177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1149}
1150
1151bool 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
1179string SanitizePath(const string& path) {
1180 return SanitizePath(path.c_str());

Callers 1

ASGetModThumbnailImageFunction · 0.85

Calls 3

endswithFunction · 0.85
IsFileFunction · 0.85
GetOriginalPathMethod · 0.80

Tested by

no test coverage detected