Fix for #962: Playlist parser encoding issues and early exit with bad filepaths#966
Fix for #962: Playlist parser encoding issues and early exit with bad filepaths#966kstauch wants to merge 1 commit intoprojectM-visualizer:masterfrom
Conversation
kstauch
commented
Feb 19, 2026
- Changed .string() conversions in AddPath and Sort to .u8string() to prevent special characters from failing to convert.
- Moved try/catch in AddPath inside for loop to prevent a file error from breaking function.
- Does not address 'Todo: Add failure feedback' in catch block, since I am not sure of the original preferred/intended method for error feedback in this case.
…revent special characters from failing to convert. Moved try/catch in AddPath inside for loop to prevent a file error from breaking function.
| currentIndex = index + presetsAdded; | ||
| } | ||
| if (AddItem(entry.path().string(), currentIndex, allowDuplicates)) | ||
| if (AddItem(entry.path().u8string(), currentIndex, allowDuplicates)) |
There was a problem hiding this comment.
u8string() is a C++20 extension. Currently, projectM has a guarantee to compile with C++14 or higher for maximum compatibility, so this function can't be used as of now. Additionally, boost::filesystem doesn't implement this method either.
If you can implement a fix that uses u8string() when the user actively uses C++20 with the STL std::filesystem implementation, but provide a C++14-compatible/Boost fallback that does the same, it can be merged.
kblaschke
left a comment
There was a problem hiding this comment.
As commented above, this must still compile with C++14/17 and using Boost's filesystem implementation, so a fix would have to provide a custom conversion function in these cases that mimics what u8string() does.
Applications should also be aware of this, as on Windows, UTF-8 filenames aren't really supported (it uses wchar-encoded names), so this might require adding a note in the API Doxygen comments as well.