* Replaces invalid filesystem characters with _. * @param filename Original filename. * @return Filename without invalid characters */
| 681 | * @return Filename without invalid characters |
| 682 | */ |
| 683 | std::string sanitizeFilename(const std::string &filename) |
| 684 | { |
| 685 | std::string newFilename = filename; |
| 686 | for (std::string::iterator i = newFilename.begin(); i != newFilename.end(); ++i) |
| 687 | { |
| 688 | if ((*i) == '<' || |
| 689 | (*i) == '>' || |
| 690 | (*i) == ':' || |
| 691 | (*i) == '"' || |
| 692 | (*i) == '/' || |
| 693 | (*i) == '?' || |
| 694 | (*i) == '\\') |
| 695 | { |
| 696 | *i = '_'; |
| 697 | } |
| 698 | } |
| 699 | return newFilename; |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * Removes the extension from a filename. |
no outgoing calls
no test coverage detected