MCPcopy Create free account
hub / github.com/ZDoom/Raze / ExtractFileBase

Function ExtractFileBase

source/common/utility/cmdlib.cpp:298–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296//==========================================================================
297
298FString ExtractFileBase (const char *path, bool include_extension, bool forcebackslash)
299{
300 const char *src, *dot;
301
302 src = path + strlen(path) - 1;
303
304 if (src >= path)
305 {
306 // back up until a / or the start
307 while (src != path && !IsSeperator(*(src-1), forcebackslash))
308 src--;
309
310 // Check for files with drive specification but no path
311#if defined(_WIN32)
312 if (src == path && src[0] != 0)
313 {
314 if (src[1] == ':')
315 src += 2;
316 }
317#endif
318
319 if (!include_extension && (dot = strrchr(src, '.')))
320 {
321 return FString(src, dot - src);
322 }
323 else
324 {
325 return FString(src);
326 }
327 }
328 return FString();
329}
330
331//==========================================================================
332//

Callers 15

ParseMapNameMethod · 0.85
STAT_UpdateFunction · 0.85
G_ValidateSavegameFunction · 0.85
startSaveGameFunction · 0.85
FindMusicFunction · 0.85
SetFileNameMethod · 0.85
SetupGameFunction · 0.85
FindMapByNameFunction · 0.85
UNSAFE_CCMDFunction · 0.85
D_AddWildFileFunction · 0.85
SplitPathFunction · 0.85
ProcessOneFileMethod · 0.85

Calls 2

IsSeperatorFunction · 0.85
FStringClass · 0.70

Tested by

no test coverage detected