---------------------------------------------------------------------
| 50 | { |
| 51 | //--------------------------------------------------------------------- |
| 52 | void CheckPattern(const std::string& name, const std::string& value) |
| 53 | { |
| 54 | auto notWindowsPathSeparator = '/'; |
| 55 | |
| 56 | if (value.find(notWindowsPathSeparator) != std::string::npos) |
| 57 | { |
| 58 | throw Plugin::OptionsParserException( |
| 59 | "Error: Invalid value \"" |
| 60 | "--" + |
| 61 | name + ' ' + value + "\". " + |
| 62 | "Please use Windows path separator '\\'."); |
| 63 | } |
| 64 | |
| 65 | // Do not iterate over path: path{"Folder\\"}.filename() == '.' |
| 66 | std::vector<std::string> parts; |
| 67 | boost::split(parts, value, [](char c) { return c == '\\'; }); |
| 68 | |
| 69 | for (const auto& part : parts) |
| 70 | { |
| 71 | if (part == "." || part == "..") |
| 72 | { |
| 73 | throw Plugin::OptionsParserException( |
| 74 | "Error: \"" |
| 75 | "--" + |
| 76 | name + ' ' + value + |
| 77 | "\": Cannot contain \".\" (current folder) or \"..\" " |
| 78 | "(parent folder)."); |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | //--------------------------------------------------------------------- |
| 84 | cov::Patterns |
no test coverage detected