Returns the name of the file given the path (extension included)
| 53 | |
| 54 | // Returns the name of the file given the path (extension included) |
| 55 | std::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 |
| 74 | std::wstring GetFileNameWithoutExtension(const wchar* filePath) |
no outgoing calls
no test coverage detected