MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / GetFileName

Function GetFileName

SampleFramework12/v1.00/FileIO.cpp:55–71  ·  view source on GitHub ↗

Returns the name of the file given the path (extension included)

Source from the content-addressed store, hash-verified

53
54// Returns the name of the file given the path (extension included)
55std::wstring GetFileName(const wchar* filePath_)
56{
57 Assert_(filePath_);
58
59 std::wstring filePath(filePath_);
60 size_t idx = filePath.rfind(L'\\');
61 if(idx != std::wstring::npos && idx < filePath.length() - 1)
62 return filePath.substr(idx + 1);
63 else
64 {
65 idx = filePath.rfind(L'/');
66 if(idx != std::wstring::npos && idx < filePath.length() - 1)
67 return filePath.substr(idx + 1);
68 else
69 return filePath;
70 }
71}
72
73// Returns the name of the file given the path, minus the extension
74std::wstring GetFileNameWithoutExtension(const wchar* filePath)

Callers 3

CompileShaderFunction · 0.85
CreateWithAssimpMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected