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

Function ExtractBaseName

source/common/filesystem/source/resourcefile.cpp:62–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62std::string ExtractBaseName(const char* path, bool include_extension)
63{
64 const char* src, * dot;
65
66 src = path + strlen(path) - 1;
67
68 if (src >= path)
69 {
70 // back up until a / or the start
71 while (src != path && src[-1] != '/' && src[-1] != '\\') // check both on all systems for consistent behavior with archives.
72 src--;
73
74 if (!include_extension && (dot = strrchr(src, '.')))
75 {
76 return std::string(src, dot - src);
77 }
78 else
79 {
80 return std::string(src);
81 }
82 }
83 return std::string();
84}
85
86void strReplace(std::string& str, const char *from, const char* to)
87{

Callers 5

OpenLumpFunction · 0.85
AddFromBufferMethod · 0.85
IsFileInFolderMethod · 0.85
OpenWHResFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected