MCPcopy Create free account
hub / github.com/DentonW/DevIL / iGetExtension

Function iGetExtension

DevIL/src-IL/src/il_internal.cpp:138–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136
137
138ILstring iGetExtension(ILconst_string FileName)
139{
140 ILboolean PeriodFound = IL_FALSE;
141 ILstring Ext = (ILstring)FileName;
142 ILint i, Len = ilStrLen(FileName);
143
144 if (FileName == NULL || !Len) // if not a good filename/extension, exit early
145 return NULL;
146
147 Ext += Len; // start at the end
148
149 for (i = Len; i >= 0; i--) {
150 if (*Ext == '.') { // try to find a period
151 PeriodFound = IL_TRUE;
152 break;
153 }
154 Ext--;
155 }
156
157 if (!PeriodFound) // if no period, no extension
158 return NULL;
159
160 return Ext+1;
161}
162
163
164// Checks if the file exists

Callers 6

iRegisterLoadFunction · 0.85
iRegisterSaveFunction · 0.85
il_pal.cppFile · 0.85
ILAPIENTRY ilTypeFromExtFunction · 0.85
ILAPIENTRY ilLoadImageFunction · 0.85
ILAPIENTRY ilSaveImageFunction · 0.85

Calls 1

ilStrLenFunction · 0.85

Tested by

no test coverage detected