| 71 | } |
| 72 | |
| 73 | bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, |
| 74 | std::string* _pExtension) { |
| 75 | if (full_path.empty()) |
| 76 | return false; |
| 77 | |
| 78 | std::size_t dir_end = full_path.find_last_of("/" |
| 79 | // windows needs the : included for something like just "C:" to be considered a directory |
| 80 | #ifdef _WIN32 |
| 81 | ":" |
| 82 | #endif |
| 83 | ); |
| 84 | if (std::string::npos == dir_end) |
| 85 | dir_end = 0; |
| 86 | else |
| 87 | dir_end += 1; |
| 88 | |
| 89 | std::size_t fname_end = full_path.rfind('.'); |
| 90 | if (fname_end < dir_end || std::string::npos == fname_end) |
| 91 | fname_end = full_path.size(); |
| 92 | |
| 93 | if (_pPath) |
| 94 | *_pPath = full_path.substr(0, dir_end); |
| 95 | |
| 96 | if (_pFilename) |
| 97 | *_pFilename = full_path.substr(dir_end, fname_end - dir_end); |
| 98 | |
| 99 | if (_pExtension) |
| 100 | *_pExtension = full_path.substr(fname_end); |
| 101 | |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, |
| 106 | const std::string& _Filename) { |
no test coverage detected