Converts: some/path/to/file.xx to: file (note that suffix is removed)
| 73 | // to: file |
| 74 | // (note that suffix is removed) |
| 75 | string GetFilename(const string& path) { |
| 76 | size_t slash_pos = path.rfind('/'); |
| 77 | if (slash_pos == path.npos) slash_pos = -1; |
| 78 | size_t dot_pos = path.rfind('.'); |
| 79 | return path.substr(slash_pos + 1, dot_pos - (slash_pos + 1)); |
| 80 | } |
| 81 | |
| 82 | // Converts: |
| 83 | // cc/ops/gen_foo_ops.h |