| 194 | } |
| 195 | |
| 196 | bool Path::IsValidFileName(const std::string_view str, bool allow_slashes) |
| 197 | { |
| 198 | const size_t len = str.length(); |
| 199 | size_t pos = 0; |
| 200 | while (pos < len) |
| 201 | { |
| 202 | char32_t ch; |
| 203 | pos += StringUtil::DecodeUTF8(str.data() + pos, pos - len, &ch); |
| 204 | if (!FileSystemCharacterIsSane(ch, !allow_slashes)) |
| 205 | return false; |
| 206 | } |
| 207 | |
| 208 | #ifdef _WIN32 |
| 209 | // Windows: Can't end filename with a period. |
| 210 | if (len > 0 && str.back() == '.') |
| 211 | return false; |
| 212 | #endif |
| 213 | |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | #ifdef _WIN32 |
| 218 |
nothing calls this directly
no test coverage detected