MCPcopy Create free account
hub / github.com/TASEmulators/fceux / parseFilepath

Function parseFilepath

src/drivers/Qt/ConsoleUtilities.cpp:163–236  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

161}
162//---------------------------------------------------------------------------
163int parseFilepath( const char *filepath, std::string *dir, std::string *base, std::string *suffix )
164{
165 if (dir)
166 {
167 dir->clear();
168 }
169 if (base)
170 {
171 base->clear();
172 }
173 if (suffix)
174 {
175 suffix->clear();
176 }
177
178 size_t i=0,j=0;
179
180 if ( filepath == NULL )
181 {
182 return 0;
183 }
184 i=0; j=0;
185 while ( filepath[i] != 0 )
186 {
187 if ( (filepath[i] == '/') || (filepath[i] == '\\') )
188 {
189 j = i+1;
190 }
191 if ( dir )
192 {
193 dir->push_back(filepath[i]);
194 }
195 i++;
196 }
197 if (dir)
198 {
199 if (j > 0)
200 {
201 dir->erase(j);
202 }
203 }
204 i = j;
205
206 while ( filepath[i] != 0 )
207 {
208 if (filepath[i] == '.')
209 {
210 j = i;
211 }
212 if (base)
213 {
214 base->push_back(filepath[i]);
215 }
216 i++;
217 }
218
219 if (filepath[j] == '.')
220 {

Callers 10

saveCdlFileAsMethod · 0.85
SaveStrippedROMMethod · 0.85
getDefaultCDLFileFunction · 0.85
openSavePresetFileMethod · 0.85
polishMethod · 0.85
doScanMethod · 0.85
getRomFileFunction · 0.85
openListCBMethod · 0.85
appendListCBMethod · 0.85
saveListAsMethod · 0.85

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected